You need to sign in to do that
Don't have an account?

Is possible to add "Required" highlight style to visual force component except <apex:inputField?
Hi All
I know we can wirte code as <apex:inputField required="true"/> to make this field required highlight and checking.
Can we make code same style for other component? such as <apex:selectList>, <apex: inputText>
I wrote as <apex:selectList required="true"/>, but no required highlight on visualforce page.
Anyone can help me?
Thanks
Kunlun
Add your style using output panel to make that field look like required
<apex:outputPanel styleClass="requiredInput" layout="block" >
<apex:outputPanel styleClass="requiredBlock" layout="block"/>
<apex:selectList id="productNameValue" disabled="false" multiselect="false" value="{!productDetails.oli.pricebookEntryId}" size="1">
<apex:selectoptions value="{!products}" />
</apex:selectList>
</apex:outputPanel>
All Answers
Add your style using output panel to make that field look like required
<apex:outputPanel styleClass="requiredInput" layout="block" >
<apex:outputPanel styleClass="requiredBlock" layout="block"/>
<apex:selectList id="productNameValue" disabled="false" multiselect="false" value="{!productDetails.oli.pricebookEntryId}" size="1">
<apex:selectoptions value="{!products}" />
</apex:selectList>
</apex:outputPanel>
Thanks very much. It works for me.
I tried with the above provided code but didn't work for me?
Is it compulsory to have such code inside a pageBlock or a pageBlockSectiom