+ Start a Discussion
Doug ACFDoug ACF 

Field Set Required Bit

Summer 11 added the ability to mark a field as required in a Field Set.  However, this does not seem to be working.  The required fields do not show as required on the VF page (even though the database-required fields do).  Has anyone gotten this to work for them?

Best Answer chosen by Admin (Salesforce Developers) 
Shashikant SharmaShashikant Sharma

Use this in your field set :  required="{!fieldAPIName.required}"

 

 

<apex:pageBlockSection title="Dynamic Object">
           <apex:repeat value="{!$ObjectType.Account.FieldSets.DemoFieldSet}" var="fieldAPIName">
               <apex:inputField value="{!sObjectToBind[fieldAPIName]}" required="{!fieldAPIName.required}"/>
           </apex:repeat>
       </apex:pageBlockSection> 

 This will show field as required.

 

All Answers

Shashikant SharmaShashikant Sharma

Use this in your field set :  required="{!fieldAPIName.required}"

 

 

<apex:pageBlockSection title="Dynamic Object">
           <apex:repeat value="{!$ObjectType.Account.FieldSets.DemoFieldSet}" var="fieldAPIName">
               <apex:inputField value="{!sObjectToBind[fieldAPIName]}" required="{!fieldAPIName.required}"/>
           </apex:repeat>
       </apex:pageBlockSection> 

 This will show field as required.

 

This was selected as the best answer
Bob_zBob_z

would this work with Web 2 Case? I need required field on my form.