0

I'm creating a form using "lightning:recordForm". I put the object's Id, the object's type and what fields should be viewed.

<lightning:recordForm aura:id="myObject"
                      recordId="{!v.recordId}"
                      objectApiName="{!v.objType}"
                      fields="{!v.fieldsObject}"
                      columns="2"
                      mode="edit"
                      onsubmit="{!c.saveObject}" />

Please, could anyone tell me if there is any way for me to retrieve the information from the "fields" parameter, and their respective values, from "aura: id"?

I want to do this procedure before the user submits the form. Because before submitting I have another procedure, so I want to do the validation first, whether the field is required or not.

1
0

For input validation you can use the onsubmit callback to do validation and stop submit if data is not valid, if you need to do validation while the user is typing then you will to use lightning:inputField and lightning:recordEditForm.

Using lightning:recordEditForm and lightning:inputField you can set input as "required" or "readonly" independently from the Object or do more complex validation using the onchange event of the aura:attribute tied to a lightning:inputField.

See: Detecting Data Changes with Change Handlers

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.