3

I had a working code on Winter 18 which override the standard submit event on recordEditForm component but it is not working on Spring 19. When I try to retrieve fields using event.getParam('fields'); it returns undefined.

This is my code:

.cmp

 <lightning:recordEditForm
                                          aura:id="editForm"
                                          recordId="{!v.recordId}"
                                          objectApiName="E2PC_Wallet_Share__c"
                                          onsuccess="{!c.handleSuccess}"
                                          onsubmit="{!c.handleSubmit}"  >

                    <lightning:messages />

...
Some input fields
...

               <footer class="slds-modal__footer">
                <lightning:button label="{!$Label.c.E2PC_Cerrar}" onclick="{!c.cancel}" variant ="neutral"/>
                <lightning:button label="{!$Label.c.E2PC_Guardar}" type="submit" variant ="brand"/>
            </footer>
            </lightning:recordEditForm>

.js

handleSubmit: function(component,event,helper){
            event.preventDefault(); 
            var fields = event.getParam('fields');
            console.log(fields.E2PC_Objetivo_Accionable__c);
            var gastoTotal = component.get("v.gastoTotal");
            if (gastoTotal < fields.E2PC_Objetivo_Accionable__c){
                component.find('notifLib').showNotice({
                    "header": "¡Error!",
                    "message": "El objetivo accionable no puede ser mayor que el gasto total"
                }); 
            }else{
                component.find('editForm').submit(fields);
            }
        }

Thank you.

  • 1
    I replicated the same code and was able to get value of the field. Can you check if the API name is proper or not and lightning:inputField is referencing that field? – Pranay Jaiswal Jan 10 at 18:55
  • please share the Some input fields of your markup – Itai Shmida Jan 13 at 6:28
  • This might be related to a Spring '19 bug that I have a ticket in for now. I'll post an update here as soon as I have one. – Shane Steinfeld Jan 16 at 18:34

Your Answer

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

Browse other questions tagged or ask your own question.