onsubmit="check_rfields();" in form tag of html. But getting failed in validation.
function check_rfields() {
var name = document.getElementById("id_rname").value;
var email = document.getElementById("id_remail").value;
var cemail = document.getElementById("id_rcemail").value;
var password = document.getElementById("id_rpassword").value;
var cpassword = document.getElementById("id_rcpassword").value;
if(name=='' || name==0
&& email=='' || email==0
&& cemail=='' || cemail ==0
&& password=='' || password==0
&& cpassword=='' || cpassword==0 ) {
document.getElementById("onsubmitErr").innerHTML
= "All fields arerequired";
return false;
}
return true;
}
如果您希望提交失败(验证失败),请使用:
onSubmit="return check_rfields()"
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.