1

Is there any way to mark the field required by default in the fieldset?

enter image description here

i want that the required checkbox become non editable.


Thanks,

1 Answer 1

2

I don't believe this can be made non-editable. If you always want this field to be required, you would have to make this field required on Object level (by checking required as true while creating this field). Then, you need to make sure that this field is only used in fieldSets and not in any where else. If you decide to use this somewhere else you will have to provide some value into the field (which may or may not be your business logic).

Coming to the programming part, we also have these two attributes in FieldSets:

  1. DBRequired - Indicates whether the field is required for the object.
  2. Required - Indicates whether the field is required in the field set.

You can easily reference these variables in your VF page like this:

<apex:repeat value="{!fields}" var="f"> <apex:inputField value="{!merch[f.fieldPath]}" required = "{!OR(f.required, f.dbrequired)}"/> </apex:repeat>

where "fields" is the list of fields of fieldSets returned by the controller.

A field in a field set can be required by either the field set definition, or the field’s own definition.

FieldSetItem represents an individual field in a field set."isRequired" field is a read only field so we also cannot modify it using apex code.

9
  • Thanks Rajeev for this details, but let me tell your the actual story i just written this post because i'm getting mentioned checkbox as none editable hence i thought, should ask people to achieve this behavior which resolve my problem. Please let me know if you have any pointer. May 15, 2015 at 5:56
  • Let me check once May 15, 2015 at 5:58
  • There must be some issue with user permissions. I checked but I could not replicate the same. I always find this checkbox editable. May 15, 2015 at 6:58
  • We also raised a SF ticket and they replied that there is some setting in the manifest/meta data file. May 15, 2015 at 9:21
  • How do we change that? May 15, 2015 at 9:22

You must log in to answer this question.

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