function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
DescendantDescendant 

Actionsupport - oncomplete not working properly

Hi everyone,
I have a problem with the apex:actionsupport.

Here I have an actionsupport within a radio input:

<input  type="radio" name="selectedRadio">
          <apex:actionsupport action="{!function1}" oncomplete="jsFunc();" event="onclick" rerender="someId">
                <apex:param name="someName" value="{!acc.ID}" assignTo="{!Account}"  >
                </apex:param>
          </apex:actionsupport>
</input>

when a radio button is clicked, the actionsupport is started and the function1 (apex) has to be executed. The account in apex from the apex:param is successfully assigned.

void function1(){
      booleanValue = true;
}

the oncomplete function - jsFunc() is also called:

jsFunc(){
      var bool = {!booleanValue};
      if(bool)
           alert('Here is the problem');
}
The problem is that the "bool" variable is here false and so the alert is not started, although it had to be previosly set to true by the function1 in apex. I guess that the oncomplete is not started at the right time?

Could someone tell me, what the problem is? 

Ashish_SFDCAshish_SFDC
Hi , 


Looks like there is problem with the Syntax, 

See below,

http://www.salesforce.com/us/developer/docs/pages/Content/pages_compref_actionSupport.htm

See the sample, 

<apex:actionsupport event="onclick" action="{!Upload_Attachment}" oncomplete="ReloadParent();"

<apex:actionSupport event="onchange" oncomplete="makeRowInit();" reRender="exportPanel" />

<apex:actionSupport event="onchange"                                               
    action="{!updateStartDate}"
    rerender="fooOutputPanel"
    oncomplete="setTimeout('setupValidation()',100)"
    status="statusStart">
</apex:actionSupport>


Regards,
Ashish