OK, I know I have asked this before, and Man-wei helped, but I still
don't get it. I have Googled until "I got blisters on me
fingers" (and eyes), but I can't find an explanation.
Simple situation: I am trying to validate an HTML form using
JavaScript. I have two variations of the JS and html illustrated by
the pseudo code below.
In the first example, when the JavaScript conditions are satisfied,
the form gets submitted, but the value of "btnSubmit" does not appear
in the post buffer.
In the second example, where the JS returns T or F, "btnSubmit" the
form (including "btnSubmit") gets Submitted whether the JS logic is
satisfied or not. In other words, having the JS function return
*false* does not stop the submit.
NOTES:
1. CAPITALS are there just to help distinguish the two methods. They
are not in the code.
2. I have stepped through the <logic> in the JS, and it all works as
designed.
Variation 1: input _button_, JS submits the form
----------------------------------------------------------
<form name='form_general' id='form_general' method='post'>
<input name="find_fname" type="text" id="find_fname" value="Ginger"/>
<input type="BUTTON" name="btnSubmit" id="btnSubmit" value="Toot"
onclick="frmChk();"/>
</form>
-----------------------
<!-- JS:
function frmChk() {
if (<logic>) {
document.form_general.SUBMIT();
}
}
----------------------------------------------------------
Variation 2: JS returns T or F
----------------------------------------------------------
<form name='form_general' id='form_general' method='post'>
<input name="find_fname" type="text" id="find_fname" value="Ginger"/>
<input type="SUBMIT" name="btnSubmit" id="btnSubmit" value="Toot"
onclick="frmChk();"/>
</form>
-----------------------
<!-- JS:
function frmChk() {
if (<logic>) {
return TRUE;
} else {
return FALSE;
}
}
----------------------------------------------------------
_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/profox
OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: http://leafe.com/archives/byMID/profox/[EMAIL PROTECTED]
** All postings, unless explicitly stated otherwise, are the opinions of the
author, and do not constitute legal or medical advice. This statement is added
to the messages for those lawyers who are too stupid to see the obvious.