I am new to Lightning and i have designed a component using recordFormEdit. On the recordFormEdit handleOnSubmit action, i am sending the data back to object using the standard functionality(Without apex controller).

Now, the same form data now needs to be sent back to apex controller(as i have to perform another action using the data).

<lightning:button aura:id="GPV" label="Save and Send fax" type="submit" onclick="{!c.saveAndSendFax}"/> 

I am having issue while accessing the form data. Is there any means to get field values of the form. i have tried the below code for getting the values but it says undefined:

 var formValue=component.find("Form").get("v.value");
        console.log("form value",formValue);
  • Could you please provide the whole code of your component? Jun 26, 2019 at 7:23

1 Answer 1


Yes you can get the form values using below piece of code:-

handleSubmit: function(component, event, helper) {
            event.preventDefault();       // stop the form from submitting
            var fields = event.getParam('fields');
            fields.Street = '32 Prince Street';

Basically, We are preventing the form getting submitted by default when user submit it via UI, and getting the Object Instance with values using event.getParam('fields') and you can access any field by using fields.your_field_api_name, also you can modify it by assigning a value to it.

In the last, You need to resubmit the form using component.find('myRecordForm').submit(fields) so that records get saved.

If you want to send the data to apex controller, You can send the fields as parameter like this:-

var action = cmp.get("c.updateOpp");
        action.setParams({ opp : fields });

where your apex method is defined like this:-

@AuraEnabled public static void updateOpp(Opportunity opp){
//do something
  • .thanks... will try it and let u know
    – Ankur ---
    Jun 26, 2019 at 7:56

You must log in to answer this question.

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