Tag: The content button will determine how the input determines the user input to start
Do form processing, is generally to check the user input is legitimate, and then all legitimate output
So we have to face a problem, how to check is not all legal? How can I end the function of the submit button when it's not legal?
At first I proposed to define a variable n, and then the user input a data each time into the detection function, and then at the end of the function as long as the judgment passed on the n++;
Finally, it is only necessary to determine whether the value of n meets the demand value to determine whether the "submit" button is functioning.
However, I also found that this method is not good, although it is convenient, but always can not eliminate the user repeated input of the same data interference, if the user has entered a legitimate data, such as user name, has been repeated input, will lead to the value of n quickly reached the standard, which will not prevent "commit" button to perform the function.
Therefore, to detect whether the form is legitimate, or directly at the end of the detection function to return a true and false value, the last Commit button on the comprehensive judgment is not all function return is true, only the whole is real to work, there is a false stop function, so more stable and most reasonable.
Check whether the form is legal, why can't use n++ discussion