Take the 2-minute tour ×
Salesforce Stack Exchange is a question and answer site for Salesforce administrators, implementation experts, developers and anybody in-between. It's 100% free, no registration required.

I have a Vf page with rendering say

 <apex:outputpanel rendered="{!payment.paytype__c==true}">
     //My code goes here
  </apex:outputpanel>

In my class

public list<paypolicy__c> payment{get;set;}
    //constructor
    payid = apexpages().currentpage.getparameters().get('id');
    payment = [select paytype__c from paypolicy__c where id=:payid];
   //save method

    if(payid != null){
        //some code
       update payment;
    }

if (payment.paytype__c==true) this condition becomes true then Update is not working....Help!!!!

share|improve this question
    
Please post your complete code. –  doga Dec 14 '12 at 8:52
    
Are you using rerender on that outputpanel? –  Bob Buzzard Dec 14 '12 at 9:05
    
yes using it.... –  Eagerin Sf Dec 14 '12 at 9:25
    
I don't see an id on the output panel, you sure you have reRender="Output_Panel_Id" from the invocation which is causing the value to change? I would also try reRendering the pageBlock. –  techtrekker Dec 14 '12 at 9:31
    
<apex:pageblocksectionItem ><Apex:outputLabel value="Allow for Payments"/> <apex:outputpanel><apex:inputCheckbox value="{!payment.paytype__c}"> <apex:actionSupport event="onclick" rerender="SelectSection"/> </apex:inputcheckbox> </apex:outputpanel> </apex:pageblocksectionItem> </apex:pageblocksection> <apex:outputpanel id="SelectSection"><apex:outputpanel rendered="{!payment.paytype__c==true}"> //code here </apex:outputpanel> –  Eagerin Sf Dec 14 '12 at 9:48

1 Answer 1

I suspect this is because you are using the onclick event - this happens as soon as the user clicks into that element and will fire before the checkbox state is updated.

If you change this to the onchange event, that will fire after the checkbox value has been updated. Note that in some versions of IE the onchange doesn't fire until the element loses focus.

share|improve this answer
    
here my problem is it is rendering correctly...But when I go for update it is not updating –  Eagerin Sf Dec 14 '12 at 9:55
    
I've updated my answer based on the code that you have posted. –  Bob Buzzard Dec 14 '12 at 10:06

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.