1

I am trying to make a field required on condition in vf page as below. But the red color bar is not appearing. How to make the red bar appear.

<apex:inputtext value="{!b.Quantity__c}"  required="{!IF(b.Service__c!=' ',true,false)}"/>

Regards

2
  • have you tried with apex:inputField?
    – Ratan Paul
    May 9, 2016 at 10:31
  • Thansx bro done... May 9, 2016 at 10:33

1 Answer 1

2

Try with apex:inputField and use conditionally required attribute

<apex:inputField value="{!b.Quantity__c}"  required="{!IF(b.Service__c!=' ',true,false)}"/>

OR If you still want to go with apex:inputText and want to show red mark then use below code based on required hide/show field

<apex:outputPanel styleClass="requiredInput" layout="block">
   <apex:outputPanel styleClass="requiredBlock" layout="block"/>
  <apex:inputText value="{!contact.Birthdate}" required="true" id="mId"/>
 </apex:outputPanel>

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .