Does anyone know how to enable multiple features? What I intended to do is: onsubmit checks if all these functions return true, if they all return true, then I do action = "checked.html"
<form id="myForm" name="myForm" action="checked.html" method="post" onsubmit="return validateName() || validatePhone() || validateAddress() || validateEmail()">
However, what actually happened, the computer checks the code from left to right, and the result of the next function will replace the previous one and so on, to the end. Thus, even if all three of the first functions return false, while the last is true, the computer will take action = "checked.html", which is not what I intend to do ... could someone please help me it was like 4 hours, I'm trying to fix it: S Thank you!
Also, when I tried to do something like <form onsubmit="return verify1() && verify2()"> it does not work, all it does is check verify1 (), and not the following ...: (
CLARIFCATION: In the view, I need to call four validation functions. Send should be prevented if all four functions do not return true, but all four should always be called, even if some of them return false.
javascript function forms onsubmit
John lee
source share