validate_form.js
Tutorial [2/8]: Debugging output
[<< < > >>]
view the code
Before the values in the form are analyzed, debugging information is presented for each element in the form.
Differences in code between the current and previous tutorial, are highlighted in red..
<HTML><HEAD>
<SCRIPT LANGUAGE="JavaScript1.3" SRC="../../../js_uncompressed/validate_form.js" TYPE="text/javascript"></SCRIPT>
<SCRIPT LANGUAGE="JavaScript1.3">
//<!---
loadVF('../../../js_uncompressed/');
configVF("CIBC_ON", 2);
function submitGoodValues(f_orm) {
f_orm.fav_int.sMsgRequired = "What's your favorite integer?";
f_orm.fav_int.sMsgTxtInt = "Your favorite integer must be an *integer* between ~RANGE_MIN~ and ~RANGE_MAX~, inclusive.";
f_orm.fav_int.iIntMin = 8;
f_orm.fav_int.iIntMax = 20;
var sErrors = getFormErrorMsgs(f_orm, ' - ');
if(sErrors) {
alert('OOPS!\n\n' + sErrors);
return false;
} else {
alert('HOORAY!\n\nForm "submitted" successfully.\n\n(To submit for real, comment out this alert line, and return true instead of false.)');
return false;
}
}
//--->
</SCRIPT>
</HEAD><BODY onLoad="completeVFLoad();">
<FORM NAME="form_fav_int" onSubmit="return submitGoodValues(this);" METHOD="post">
What's your favorite integer between 8 and 20? <INPUT TYPE="text" NAME="fav_int" SIZE="20">
<BR><INPUT TYPE="submit" VALUE="Here you go">
</FORM>
</BODY></HTML>
|
TOP Debugging information: Notes
Debugging information includes basic information on the element itself, the current value, and lists all validate_form.js
code. For technical details, see vf_dbgVF.dbgVF()
.
Differences between Mozilla and Internet Explorer
alert()
boxes in IE are more pleasant than Mozilla, primarily because Mozilla ignores tabs.
Mozilla

Internet Explorer

Copyright (C) 2003-2005, Jeff Epstein. All rights reserved.