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"
                      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 Answer 1


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

You must log in to answer this question.

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