You need to sign in to do that
Don't have an account?
Meer Salman
Call script function behind event?
Hi,
Is this possible to call the script functions on the events of a component or in <apex:actionsuppor>? I have the following function in a script which I want to be called on the 'onselect' event of the <apex:outputfeild>.
<script type="text/javascript"> var __sfdcSessionId = '{!GETSESSIONID()}'; </script>
<script src="../../soap/ajax/24.0/connection.js" type="text/javascript"> </script>
<script type="text/javascript">
function ShowDescription(acc)
{
var queryResult=sforce.connection.query(<my query>);
var records=queryResult.getArray('records');
document.getElementById(acc.id.replace("acc","desc")).value=records[0].Description__c;
}
</script>
<apex:pageBlock mode="inlineEdit" title="Journal Detail" id="td">
<apex:pageBlockSection columns="2">
<apex:outputField id="period_date" value="{!Journal.Period__c}">
<apex:actionSupport event="onchange" action="ShowJournalDate(period_date)" rerender="journal_date"/>
</apex:outputField>
<apex:outputLabel />
<apex:outputField id="journal_date" value="{!Journal.Journal_Date__c}"/>
</apex:pageBlockSection>
</apex:pageBlock>
Regards,
Meer Salman
This doesn't really make sense in the context of an outputfield - the value can't be changed. Events like onchange, onselect are only supported by a few HTML elements, usually those that involve user input.
Can you explain a little more about what you are trying to achieve?
I agree with you, but here I am having a <apex:pageBlock> in mode="inlineEdit", so I want to change the value of the Journal.Journal_Date__c with the change of Journal.Period__c value. I didn't find any of the way to do it by extension so i thought to do it by script. I have the following VFPage and Class
*****EXTENSION*****
*****VFPage*****
I tried it some of the other ways as well but it didn't give a nice look the layout.
Regards,
Meer Salman
What does the 'inlineEdit' mode do? According to the docs, that isn't one of the supported values.
If I am not wrong I guess by using inlineEdit you can view the values of the fields and if want to edit you can double click on it.
http://www.salesforce.com/us/developer/docs/pages/Content/pages_compref_inlineEditSupport.htm
check the mode of the <apex:pageblocktable>
Please correct me if I am wrong.
Thanks
The mode attribute for a pageblocktable only controls the display aspect as far as I'm aware. That link is demonstrating the inlineeditsupport element, nested in the outputfield:
I guess even if you remove inlineeditsupport element it works the same way, anyhow let make it your way, now we can understand that the user can change the value of the field in this mode. Now what I want is that when the value for the Journal.Period__c is changed Journal.Journal_Date__c should also get equal to it.
I guess you understood the issue now.
Many Thanks
If Journal.Period__c is going to have the inlineedit support, I suspect you'll need the user to save the record in order to be able to populate another field with the value. The Salesforce javascript will be controlling this element and I don't know how easy it would be to hook on the end of that.