You need to sign in to do that
Don't have an account?

Rerender is not working
<apex:outputText value="Use the same address as sold to"/>
<apex:inputCheckBox value="{!useSameAddress}">
<apex:actionSupport event="onchange" rerender="shipTo, billTo"/>
</apex:inputCheckBox>
<apex:pageBlockSection title="Partner Function Information"columns="2" collapsible="true">
<apex:inputField id="shipTo" value="{!quote.Ship_To__c}" rendered="{NOT(!useSameAddress)}"/>
<apex:inputField id="billTo" value="{!quote.Bill_To__c}" rendered="{NOT(!useSameAddress)}"/>
</apex:pageBlockSection>
when I check the box, the input fields dont show up. The value of useSameAddress doesnt change. i have getter and setter functions for useSameAddress in the apex class.
Can you please help?
Thanks,
Pooja
Not what I meant. Did you see the part where I said outputText is not outputting an id so there's nothing to rerender?
<apex:page controller="Sample"> <apex:form > <apex:inputCheckBox id="myCheckBox" value="{!checkBoxValue}"> <apex:actionSupport event="onclick" reRender="shipTo"/> </apex:inputCheckBox> <apex:outputPanel id="shipTo"> <apex:outputText value="hello" rendered="{!checkBoxValue}" /> </apex:outputPanel> </apex:form> </apex:page>
All Answers
I changed it but didnt work. Simplified the versionbelow also doesnt work.
<apex:page controller="Sample">
<apex:form >
<apex:inputCheckBox id="myCheckBox" value="{!checkBoxValue}">
<apex:actionSupport event="onclick" reRender="shipTo"/>
</apex:inputCheckBox>
<apex:outputText id="shipTo" value="hello" rendered="{!checkBoxValue}" />
</apex:form>
</apex:page>
public class Sample
{
boolean checkBoxValue;
public boolean getCheckBoxValue()
{
return checkBoxValue;
}
public void setCheckBoxValue(boolean checkBoxValue)
{
this.checkBoxValue = checkBoxValue;
}
}
So your second example doesn't work because outputText doesn't actually output any kind of tag with an id, it just outputs the text. So there's nothing there to rerender. Yes, we consider this a bug and have been discussing how to handle it (most likely if you specify an id with outputText we will output a span). If you wrap your outputText in an outputPanel and rerender that instead, it will work.
I'd have to dig into why you're having the same issue with inputField but for now you should just rerender the pageBlockSection instead of each individual inputField.
I wrapped it into outputPanel and also used a formula as well.
It still doesnt work.
<apex:page controller="Sample">
<apex:form >
<apex:inputCheckBox id="myCheckBox" value="{!checkBoxValue}">
<apex:actionSupport event="onclick" reRender="panel"/>
</apex:inputCheckBox>
<apex:outputPanel id="panel" rendered="{!checkBoxValue}">
<apex:outputText id="shipTo" value="{!hello}" />
</apex:outputPanel>
</apex:form>
</apex:page>
public class Sample
{
boolean checkBoxValue;
public boolean getCheckBoxValue()
{
return checkBoxValue;
}
public void setCheckBoxValue(boolean checkBoxValue)
{
this.checkBoxValue = checkBoxValue;
}
String hello = 'hey';
public String getHello()
{
return hello;
}
public void setHello(String hello)
{
this.hello = hello;
}
}
Not what I meant. Did you see the part where I said outputText is not outputting an id so there's nothing to rerender?
<apex:page controller="Sample"> <apex:form > <apex:inputCheckBox id="myCheckBox" value="{!checkBoxValue}"> <apex:actionSupport event="onclick" reRender="shipTo"/> </apex:inputCheckBox> <apex:outputPanel id="shipTo"> <apex:outputText value="hello" rendered="{!checkBoxValue}" /> </apex:outputPanel> </apex:form> </apex:page>
If you see in message 5, I am using hello as a variable in the controller class.
Am I understanding this wrong? Can you write a sample code or correct my code? My actual code (which as inputFields which should be rendered when a check box is selected and another scenario where inputFields should be rendered based on a dropdown selection) is a little different. But if this concept works it should work.
Thanks a lot for all the help so far !! I have to get this working before Monday morning EST.
Pooja.
Thanks a tonne!!
It works perfect now..
Apart from rerendering the pageBlockSection i was writing the rendered attribute with the pageBlockSection which was messing it up.
Thanks again,
Pooja