When form input is important, it should always be verified using a secure server-side script.Otherwise a browser with Java Script disabled, or a hacker trying to compromise your site, can easily submit invalid data. The first test in the example is therefore only necessary in order to provide a different error message when the input is blank.I am trying to make an order form that validates all entries to make sure the text boxes have data, and that the one of the 3 radio buttons is selected.
Only when all conditions have been satisfied do we reach the command, in which case the form will be submitted.
You'll see that the all validation scripts presented on this and subsequent pages adhere to the same basic format.
document.myfrm.txt_bb1.value==0 should be: document.myfrm.txt_1.value==0 also: Upon setting a return, the function will end and return the false or true set out in your function.
the first if when values are "" or 0 according your condition will always return false.
Edit: I've found this example in my own code: Write you own control which accepts a regular expression string for validation check during design time.