I have a command button which has an action status and param values .please see code below

<apex:commandButton id="songdbabc" action="{!synchsongmethod}" 
    immediate="true" status="counterStatus" 
    value="Synch from song db" 
    oncomplete="simplejavascriptfunction();return false;" 
    rendered="{!IF(checkUserAdmin && 
        ((case.Status=='New') || (case.Status=='In Progress') || 
        (case.Status=='Resubmit for Verification')) && 
    <apex:param name="seqId" value="{!wrapSong.seqObject.id}" 

Now oncomplete i want to call a javascript function and pass values as

oncomplete="testsort('segSec{!segment.Segment_Order_No__c}');return false;"`

However i am getting error:

unknown controller property segment

Segment is an apex variable as below:

<apex:variable var="segment" value="{!segList[0]}"/>

But in command button segment is being recognized as controller property. I know that using input button I can get pass that error message but we cant use input button as it we cant use status in input button

Is there any other way of going around this , Any suggestions would be highly appreciated

  • Similar to a variable in apex, apex:variable also has a scope and is only accessible inside declared tag. You might want to move the variable to top/higher location so that it'd be accessible to the oncomplete method. Other than that, its really hard to understand what you want to achieve. Also avoid using return false; instead use rerender tag to stop complete page reload. – Raul Oct 23 '17 at 21:46
  • I tried placing the button in the same scope as apex :variable but i still get the same message – Natasha Oct 24 '17 at 8:09
  • Would like to see the complete code, that would help to troubleshoot. – Sikha Baid Oct 24 '17 at 10:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.