You need to sign in to do that
Don't have an account?
imishra
Urgent-----Validation rule on multiselect picklist
Hi,
I have a multi select picklist with different values. I want when other is selected from multiselect picklist, and other__c(text field) is empty, it should give an error message.
How to implement this in visualforce page?
Any help is appreciated.
Thanks.
see the code below as you put all the values of the picklist in a list specify the value saying if the lsit has value as other make the other filed as mandatory and put the error
<apex:selectList size="1" value="{!contPreference}">
<apex:actionSupport event="onchange" reRender="optSection"/>
<apex:selectOption itemValue="Email" itemLabel="Email"/>
<apex:selectOption itemValue="Email & Text" itemLabel="Email & Text"/>
</apex:selectList>
</div>
</apex:outputPanel>
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem rendered="{!contPreference = 'Email & Text'}">
<apex:outputLabel value="For text, please select your carrier"/>
<apex:outputpanel >
<div class="requiredInput">
<div class="requiredBlock"></div>
<apex:selectList size="1" value="{!carrierName}">
<apex:actionSupport event="onchange" reRender="inspectionBlock"/>
<apex:selectOption itemValue="AT&T" itemLabel="AT&T"/>
All Answers
see the code below as you put all the values of the picklist in a list specify the value saying if the lsit has value as other make the other filed as mandatory and put the error
<apex:selectList size="1" value="{!contPreference}">
<apex:actionSupport event="onchange" reRender="optSection"/>
<apex:selectOption itemValue="Email" itemLabel="Email"/>
<apex:selectOption itemValue="Email & Text" itemLabel="Email & Text"/>
</apex:selectList>
</div>
</apex:outputPanel>
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem rendered="{!contPreference = 'Email & Text'}">
<apex:outputLabel value="For text, please select your carrier"/>
<apex:outputpanel >
<div class="requiredInput">
<div class="requiredBlock"></div>
<apex:selectList size="1" value="{!carrierName}">
<apex:actionSupport event="onchange" reRender="inspectionBlock"/>
<apex:selectOption itemValue="AT&T" itemLabel="AT&T"/>
Thanks for the quick reply. This works fine but the problem is when i fill the other text its saved , but still the error message remains there.
How can i remove the message after the page is saved.
Hi
If you see my code i have defined in a way stating a paticular block apprears only if a value in the other field has satisfied the codition .you use the same logic which defines like if the value in the block is other you will make the other field appear and save it as required . There should not be any issues once you save the feild .can you post your code so that i can look at it ?
Regards
vivek