Hello all,
The search function of this forum isn't working although I found a similar question on the forum using Google, but the replies don't help me. So, forgive me please if this has been answered before.
I have a cgi program in Python that genereates an HTML page with a form with hidden fields whose values are set via the following:
-
##Print hidden "usernameH", "passwordH", "timeH", "checksumH", and toPageH, fields with value attribs
-
print"""
-
<input name="usernameH" type="hidden" id="usernameH" value="%s">
-
<input name="passwordH" type="hidden" id="passwordH" value="%s">
-
<input name="timeH" type="hidden" id="timeH" value="%f">
-
<input name="checksumH" type="hidden" id="checksumH" value="%s"></p>
-
<input name="toPageH" type="hidden" id="toPageH" value="queryPage"></p>
-
<p>
-
"""%(usernameH, passwordH, timeH, checksumH)
The Submit action is handled with bits of javascript that follow:
-
<!--javascript function that returns true if username and password lengths are both greater than zero-->
-
-
<script language="JavaScript">
-
function validate() {
-
if (loginForm.username.value.length > 0 && loginForm.password.value.length > 0){return true;}
-
else{return false;}
-
}
-
</script>
-
and:
- <FORM name="loginForm" ACTION="hw6mod.cgi" METHOD="POST" onsubmit=" if(!validate()){
-
alert('Your username and/or password is blank.'); return false; }">
The problem is that when I Submit the form back to my cgi program and I have the code below, the usernameH and passwordH values are NOT in the keys!
- form = cgi.FieldStorage()
-
myKeys = form.keys()
-
def printKeys(myKeys):
-
for key in myKeys:
-
print """<p>key: %s, value: %s type: %s</p>"""%(key, form[key].value, type(form[key].value))
-
What's going wrong?
Thanks!