This should be a pretty simple answer, but I can't seem to find anything out there. I have two lightning-record-edit-form elements inside of the same template element. Using the QuerySelector or by another means, I want to select only one of them and submit it. The one I want to submit also happens to be the second on the template.

1 Answer 1


You can do something similar to below:-

handleClick() {
      .forEach(element => {
        if(element.id==='second form id'){

Here, I am accessing both the form elements using querySelectorAll and running for each loop on both of them. Then checking the id to identify the second form element and then submit the form using submit method.

You must log in to answer this question.

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