I have a fieldset which I get from serverside and load on clientside I am adding the required parameter to the field but my component does not alert on required. I added the values behind the fields and these have the correct value. What am I missing?

<aura:iteration items="{!v.fields}" var="field" >
            <aura:if isTrue="{!v.inputModeBool == true? true: false}">
                <lightning:inputField fieldName="{!field.fieldPath}"  required="{!field.required}"/>{!field.required}
            <aura:if isTrue="{!v.inputModeBool != true? true: false}">
                <lightning:layout >
                    <lightning:layoutitem size="10">
                        <lightning:outputField fieldName="{!field.fieldPath}"/>
                    <lightning:layoutitem size="2">
                        <lightning:buttonIcon iconName="utility:edit" variant="bare"

The specification of lightning:inputField does not specify required as an attribute. The documentation tab mentions the following:

To persist requiredness on a field, select the Required checkbox when defining the custom field in Setup. A required field is displayed with a red asterisk next to the field label. An error message is displayed below a required field if you try to submit the form before entering a value.

So it seems, in order to use the lightning:inputField component, either the field has to be required at the schema level or you would have to implement the validation in your javascript controller.

  • The fields are set as required in setup in this case on field level and in the fieldset.
    – Thomas
    Jul 18 '19 at 15:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.