as you can see, i have to functions first to check if all forms are not empty and the second function is to verify the captcher, when i combine them together both work at the same time, i want to first to verify the first function, when that function returns true then the other function starts,
here is the code that i used on form
<form action="reg.php" method="post" 开发者_如何转开发enctype="application/x-www-form-urlencoded" onsubmit=" Checking(this); return jcap();" >
As you can see both function execute at the same time
so i tried this
<form action="reg.php" method="post" enctype="application/x-www-form-urlencoded" onsubmit=" if(Checking(this) == true ){ return jcap();}" >
is bypass both
i also tried this
<form action="reg.php" method="post" enctype="application/x-www-form-urlencoded" onsubmit=" return(Checking(this) && jcap(this));" >
and it bypassed jcap function
It look like that Checking()
doesn't have a valid return value. The script might have errored and block the processing. Update the function accordingly. E.g.
function Checking(form) {
if (form is valid) {
return true;
} else {
return false;
}
}
This way the third approach should work.
That said (and unrelated to the actual problem), I'd try to follow the JavaScript coding conventions (functions start with lowercase) and also give the functions a bit more sensible name, e.g. checkCaptcha()
and checkForm()
.
Combine both of them in a function:
function checkMyForm() {
if(check_fields() == true) {
if(check_captha() == true) {
return true;
}
}
return false;
}
No your onsubmit syntax is wrong.
Try this
function checkForm() {
if(Checking() && jcap())
return true;
return false;
}
and your form:
<form action="reg.php" method="post" enctype="application/x-www-form-urlencoded" onsubmit="return checkForm();">
精彩评论