how to send two forms with one click (script ninjaforms id)
i need the user to send 2 forms with one button-click, so i'm basically trying to merge two buttons into a third one, in order to pass data along, but don't know what i'm doing wrong here.
i've been trying to get this solution to work, but i get console-error
"uncaught typeerror: cannot read property 'submit' of null at SubmitForms"
one of the forms is generated with ninjaforms, the other one by another plugin... i'm not sure if i can address/call the ninjaform id or its name in the right way. where is any of the two to be found? i tried many different variations, all with the same result.
so, my (third) button is hooked in like this:
...
function button() {
echo 'input type="button" name=button class=button value="click me" onclick="submitForms()" /';
}
and this is what the js looks like (in header):
script
submitForms = function(){
document.getElementById("ninja_form_id_2").submit();
document.getElementById("id_form_2").submit();
}
/script
i never used javascript before, so i'm not sure if i implemented it like i should. thanks for help!
Topic buttons plugins Wordpress javascript
Category Web