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
CodeBeeCodeBee 

How to render a DIV section ?

Good day,

 

I need to show a TextArea box when user select specific value from the multi-picklist, i do a little test myself on how to display the textarera if the multi-picklist value was change, here some sample code

 

 

VF page
---------------

<apex:pageblock >
<apex:pageBlockSection collapsible="false" column="1"> <apex:pageBlockSectionItem> <apex:outputLabel value="Rating :" /> <apex:inputField value="{!myObject.multipicklist}" > <apex:actionSupport event="onchange" action="{!doMyAction}" /> </apex:inputField> </apex:pageBlockSectionItem> </apex:pageBlockSection> <apex:pageBlockSection collapsible="false" column="1"> <apex:pageBlockSectionItem rendered="{!isVisible}"> <apex:outputLabel value="Comment" /> <apex:inputField value="{!myObject.myTextArea}" /> </apex:pageBlockSectionItem> </apex:pageBlockSection> </apex:pageBlock>

Controller ----------- public isVisible {set;get;} public PageReference doMyAction(){ isVisible = true; return null; }

 

I can't figure out how to display the myTextArea div , anyone feel free to pinpoint my mistake, thank you !

 

JimRaeJimRae

You need to define a rerender on your actionsupport and an id on the element to rerender

 

 

VF page
---------------

<apex:pageblock >
<apex:pageBlockSection collapsible="false" column="1">
<apex:pageBlockSectionItem>
<apex:outputLabel value="Rating :" />
<apex:inputField value="{!myObject.multipicklist}" >
<apex:actionSupport event="onchange" action="{!doMyAction}" rerender="comment1" />
</apex:inputField>
</apex:pageBlockSectionItem>
</apex:pageBlockSection>


<apex:pageBlockSection collapsible="false" column="1">
<apex:pageBlockSectionItem rendered="{!isVisible}" id="comment1">
<apex:outputLabel value="Comment" />
<apex:inputField value="{!myObject.myTextArea}" />
</apex:pageBlockSectionItem>
</apex:pageBlockSection>

</apex:pageBlock>

 

 

CodeBeeCodeBee

Thanks Jim,

 

I found that pageBlockSectionItem can't be render and it only pageBlockSection allow.