php - Javascript validation: Block special characters From input text box when click on submit -
How can I enter special characters in the text box (txt_edition) by editing the code given below for verification? I want only numbers to be registered.
& lt; Script & gt; Validate function form () {var x = document.forms ["frm_bokAdd"] ["txt_edition"]. Values; If (x == faucet || X == "") {Warning ("version will be filled"); return false; } & Lt; / Script & gt; Below is my form
& lt; Form name = "frm_bokAdd" action = "#" method = "post" onsubmit = "return validateForm ()" & gt; & Lt; Table border = "0" align = "center" & gt; & Lt; TR & gt; & Lt; TD & gt; & Lt; Input type = "text" name = "txt_edition" & gt; & Lt; / Td> & Lt; / Tr & gt; & Lt; TR & gt; & Lt; TD & gt; & Lt; Input type = "submit" name = "book INns_submit" value = "add" & gt; & Lt; / Td> & Lt; / Tr & gt; & Lt; / Table & gt; & Lt; / Form & gt; How do I restrict the entry of special characters in the text box (txt_edition)? Do not allow users to come in any way with a valid value, you actually only take into account that the value is valid when it is sent to the server, and still You must be valid even there.
Code below for verification by editing? I want only numbers to be registered.
Just test when the form is submitted, passing the form reference in the call:
& lt; Form ... onsubmit = "return valid form (this)" & gt; and function: function
Comments
Post a Comment