Hello guys ,
If we are creating a select list on Visualforce page its not possible to make it required by setting its attribute required="true".
So we have to alter some code in that.
For example :
<apex:selectList value="{!countries}" multiselect="false" size="1"> <apex:selectOptions value="{!items}"/> </apex:selectList>
items - > list of your selected items
countries - > variable which hold the selected value.
required="true" - > Did not work in this way ..
Now I am writing some think like this..
<apex:form > <apex:pageBlock > <apex:pageBlockSection > <apex:outputPanel styleClass="requiredInput" layout="block" id="pwPanel" > <apex:outputPanel styleClass="requiredBlock"/>
<apex:selectList value="{!countries}" multiselect="false" size="1"> <apex:selectOptions value="{!items}"/> </apex:selectList> </apex:outputPanel> <apex:commandButton value="Test" action="{!test}" rerender="out" status="status"/> </apex:pageBlockSection> </apex:pageBlock> </apex:form>Now this select list values will display as required even no need to put the required attribute.
Cheers.....................
ReplyDeleteWonderful post on Salesforce CRM strategies and its features keep doing. Thank you
Regards:
Salesforce Developer 501 Training in Chennai
Salesforce Developer 502 Training in Chennai
Great post !!! It really works for me.
ReplyDeleteI follow this blog very useful
ReplyDeletemachine learning training institute in chennai
You are doing a great job. I would like to appreciate your work for good accuracy.
ReplyDeleteMachine Learning Course in Chennai | Machine Learning Training in Chennai