[Ctrl + A selection (note: if you need to introduce external Js to refresh to perform]
Js validation for positive integer

code is as follows:


<Script>
var re=/^ 1-9] [d * $/;//smart authentication single characters
if (! Re. Test (document. GetElementById (' group_order). The value)) {
alert (" group sorting must be numeric! ");
document. GetElementById (' group_order). The focus ();
return false.

} </script> Value <
if (0 | | value!=parseInt (value)) {
alert (" not a positive integer ");
} else {
alert (" is a positive integer ");
}

js sending form (method a) : check_input is js function, but this method will drop all pages within the form to send

code is as follows:



<% form_tag ({: controller=>"the transaction", : action=>"check_cid"}, {: name=>"form1: method=>" post ": multipart=>" true ", : onsubmit=>"return check_input ();"}) do % >
<% % end >

js sending form (method 2) : check_original is js function, this method will send the specified form, regardless of the method, a method in front of the two don't forget to add the return

code is as follows:



<%=form_tag ({: controller=>"the program", : action=>"index"}, {: name=>"newform: method=>" post ": multipart=>" true "}) % >
<%=submit_tag "add", {: name=>'newgroup' : onclick=>'return check_original (); '} % >
<% %=form_tag >

to be continued...


This concludes the body part