Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Confirm box

Status
Not open for further replies.

jianhua

Programmer
Jun 22, 2001
55
US
I want to use a javascript to validate a form. After everything is all right, a confirm box pops up to ask whether the user wants to submit the form, if yes, the form is submitted and the database is updated, if no, no change to the database. I use <cfquery> (Cold Fusion) to updtate the database.

Currently the validation is working, but when I added the confirm box, it's not working. My logic is:

function upd_emp(f){
var name_err = false;
for loop here {
if (...){
name_err = true;
break;
}
} //for loop ends
if (name_err == true){
alert(&quot;error...&quot;);
return(false);
} else {
if (confirm(&quot;...&quot;)){
return(true);
} else {
return(false);
}
}
}
}

Please let me know what's wrong with my logic...
Thanks in advance...
-J
 
may be your error is in the function call : in order for your return value to be used, you must call your function this way :

.. onload=&quot;return upd_emp(f);&quot; .. Water is not bad as long as it stays out human body ;-)
 
you're welcome. Water is not bad as long as it stays out human body ;-)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top