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
MetalOzMetalOz 

ReRender Simple Problem

I don't understand why this code won't work.  I just want a comments box to appear if you select that the customer refused the survey...

 


<apex:actionRegion >
                <apex:pageBlockSectionItem >
                    <apex:outputLabel value="Customer refused survey?" for="refused"/>
                    <apex:InputField value="{!Post_Install_Survey__c.Refused__c}" id="refused" required="true">
                    <apex:actionSupport event="onChange" reRender="rfcomments"/>
                    </apex:InputField>
                </apex:pageBlockSectionItem>
                </apex:actionRegion>
                <apex:InputField value="{!Post_Install_Survey__c.Services__c}"/>
                <apex:pageblockSectionItem id="rfcomments">
                <apex:InputField value="{!Post_Install_Survey__c.Refused_Comments__c}" rendered="{!Post_Install_Survey__c.Refused__c == 'Yes'}"/>
                </apex:pageblockSectionItem>
sham_2sham_2

Hi MetalOz,

 

PageBlockSectionItem doesn't support reRendering.Hence you need to remove Post_Install_Survey__c.Refused_Comments__c out of pageBlockSectionItem

Richie DRichie D

Another way would (possibly) be to wrap tthe pageblocksectionitem in an outputPanel and rerender that.

If you keep the Refused_Comments__c in the PageBlockSectionItem then you'll have the label pulled in correctly.

 

R. 

MetalOzMetalOz
I tried changing the PageBlockSectionItem to an OutputPanel and it still doesn't work:
                 <apex:actionRegion >
                <apex:pageBlockSectionItem >
                    <apex:outputLabel value="Customer refused survey?" for="refused"/>
                    <apex:InputField value="{!Post_Install_Survey__c.Refused__c}" id="refused" required="true">
                    <apex:actionSupport event="onChange" reRender="rfcomments"/>
                    </apex:InputField>
                </apex:pageBlockSectionItem>
                </apex:actionRegion>
                <apex:InputField value="{!Post_Install_Survey__c.Services__c}"/>
                <apex:Outputpanel id="rfcomments">
                <apex:InputField value="{!Post_Install_Survey__c.Refused_Comments__c}" rendered="{!Post_Install_Survey__c.Refused__c == 'Yes'}"/>
                </apex:Outputpanel>
Richie DRichie D

Can you try moving the apex: actionregion tag to surrounding the offending outputpanel and/or remove it all together.

 

MetalOzMetalOz
Remove the actionregion tag or the outputpanel tag?  I tried to simplify but this doesn't work either:
                 <apex:actionRegion>
                    <apex:outputLabel value="Customer refused survey?" for="refused"/>
                    <apex:InputField value="{!Post_Install_Survey__c.Refused__c}" id="refused" required="true">
                        <apex:actionSupport event="onChange" reRender="rfcomments"/>
                    </apex:InputField>
                    <apex:Outputpanel id="rfcomments">
                        <apex:InputField value="{!Post_Install_Survey__c.Refused_Comments__c}" rendered="{!Post_Install_Survey__c.Refused__c == 'Yes'}"/>
                    </apex:Outputpanel>
                </apex:actionRegion>
Richie DRichie D

hmmm.

 

Do you have a messages tag on the page? <apex: messages/> ? If you don't you could try adding on to see whether your required="true" is stopping the submission. Could also try taking off the required flag all together first.

 

Previous email meant to remove the actionregion tag.

 

This should be quite easy to do so we're obviously missing something obvious....

 

MetalOzMetalOz
I have tried wrapping the actionregion tags around both fields individually and together and haven't had success.  I removed the required attribute altogether as well.  I don't know the syntax for the messages tag...