You need to sign in to do that
Don't have an account?
Prashant Bhatt
Hi, I am new to salesforce. I am using salesforce sites to create a webform . I have a field where u can select multiple checkboxes , if u select 'OTHER' it should generrate a inputfield
This is my visualforce code. Please help!
<apex:pageBlockSection title="RMS SYSTEM" columns="1" collapsible="false" id="thePbs2" >
<apex:outputLabel value="{!$ObjectType.Datavis_Client__c.Fields.RMS_SYSTEM__c.InlineHelpText}" />
<apex:selectcheckboxes layout="pageDirection" value="{!MPItems}" label="" id="checkbox1">
<apex:selectoptions value="{!MPOptions}" >
<apex:actionSupport event="onselect" reRender="ajaxrequest" />
</apex:selectoptions>
</apex:selectcheckboxes>
<apex:outputPanel id="ajaxrequest">
<apex:outputPanel rendered=" {!MPOptions=='OTHER'}" >
<apex:inputField value="{!Datavis_Client__c.Others_data__c}" />
</apex:outputPanel>
</apex:outputPanel>
</apex:pageBlockSection>
<apex:pageBlockSection title="RMS SYSTEM" columns="1" collapsible="false" id="thePbs2" >
<apex:outputLabel value="{!$ObjectType.Datavis_Client__c.Fields.RMS_SYSTEM__c.InlineHelpText}" />
<apex:selectcheckboxes layout="pageDirection" value="{!MPItems}" label="" id="checkbox1">
<apex:selectoptions value="{!MPOptions}" >
<apex:actionSupport event="onselect" reRender="ajaxrequest" />
</apex:selectoptions>
</apex:selectcheckboxes>
<apex:outputPanel id="ajaxrequest">
<apex:outputPanel rendered=" {!MPOptions=='OTHER'}" >
<apex:inputField value="{!Datavis_Client__c.Others_data__c}" />
</apex:outputPanel>
</apex:outputPanel>
</apex:pageBlockSection>
Why do you have 2 output panels - You can merge into one -
Try this instead - In the controller - Let me know, if it helps you
Thanks,
Sumit Kumar Singh
All Answers
I can't see any action attribute in Action support. In the controller - Update the output panel like this - Hope, this will help you.
Thanks,
Sumit Kumar Singh
My controller code-
public PageReference showOrHideInputBox() {
List<SelectOption> rmsOption = this.MPOptions;
for(SelectOption s : rmsOption) {
isRendered = (s.getValue()=='OTHER') ? true : false;
system.debug(isRendered);
}
return null;
}
Visualforce code-
<apex:pageBlockSection title="RMS SYSTEM" columns="1" collapsible="false" id="thePbs2" >
<apex:outputLabel value="{!$ObjectType.Datavis_Client__c.Fields.RMS_SYSTEM__c.InlineHelpText}" />
<apex:selectcheckboxes layout="pageDirection" value="{!MPItems}" id="checkbox1">
<apex:selectoptions value="{!MPOptions}" >
</apex:selectoptions>
<apex:actionSupport event="onclick" action="{!showOrHideInputBox}" reRender="ajaxrequest"/>
</apex:selectcheckboxes>
<apex:outputPanel id="ajaxrequest">
<apex:outputPanel rendered="{!isRendered}" >
<apex:inputField value="{!Datavis_Client__c.Others_data__c}" />
</apex:outputPanel>
</apex:outputPanel>
</apex:pageBlockSection>
Why do you have 2 output panels - You can merge into one -
Try this instead - In the controller - Let me know, if it helps you
Thanks,
Sumit Kumar Singh
You can use <apex:actionRegion> to over come this -
Have a look at this -
http://www.tgerm.com/2010/09/visualforce-actionregion-deep-dive.html
<apex:pageBlockSection title="RMS SYSTEM" columns="1" collapsible="false" id="thePbs2" >
<apex:outputLabel value="{!$ObjectType.Datavis_Client__c.Fields.RMS_SYSTEM__c.InlineHelpText}" />
<apex:actionRegion>
<apex:selectcheckboxes layout="pageDirection" value="{!MPItems}" id="checkbox1">
<apex:selectoptions value="{!MPOptions}" >
</apex:selectoptions>
<apex:actionSupport event="onclick" action="{!showOrHideInputBox}" reRender="ajaxrequest"/>
</apex:selectcheckboxes>
</apex:actionRegion>
<apex:outputPanel id="ajaxrequest">
<apex:outputPanel rendered="{!isRendered}" >
<apex:inputField value="{!Datavis_Client__c.Others_data__c}" />
</apex:outputPanel>
</apex:outputPanel>
</apex:pageBlockSection>
if i am putting apexRegion inside <Apex:selectcheckboxes> it is throwing error that select box should have one child .and outside its same as without apexRegion. Please help!