RE: form user interface issue
Maybe the button dosen't have focus when the enter key is hit. This added to your javascript may help function check_email_onkeypress() { if ("13" == window.event.keyCode) { form.submit(); } } Also, I usually use the name attribute for the form. Like If you do that, your elements need to be be preceeded with f1, so the code block would be function f1.check_email_onkeypress() { if ("13" == window.event.keyCode) { f1.submit(); } } Thanks a good practice because a page can have multiple forms. Good Luck, bb -Original Message- From: Hughes, Andrew [mailto:[EMAIL PROTECTED] Sent: Tuesday, April 01, 2003 10:31 AM To: [EMAIL PROTECTED] Subject: form user interface issue I have a form that I am using to add data to a mysql database table. I am using a .pl scrtipt to generate the html. I am using cgi.pm and param() to insert the form data. And, I am using to the print< Insider's Advantage function submitIt(form) { if (!validEmail(form.check_email.value)) { alert("Invalid AOLTW Business E-Mail Address.") form.check_email.focus() form.check_email.select return false } } function validEmail(check_email) { invalidChars = " /:,;" if (check_email =="") { return false } for (i=0; i-1) { return false } } atPos = check_email.indexOf("@",1) if (atPos == -1) { return false } if (check_email.indexOf("@",atPos+1) > -1) { return false } periodPos = check_email.indexOf(".",atPos) if (periodPos == -1) { return false } if (periodPos+3 > check_email.length) { return false } return true } //end validEmail http://insidersadvantage.com/images/promotions/2003brochure/signup_head .jpg" border="0"> Please enter your work email address below so that we may determine whether or not you are an E-Club member. * Indicates a required field. Work Email Address: * checkemailform } ..snip3.. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: form user interface issue
That form probably has a submit button that has a parameter name="...". The script might be checking for that param('...'). If the form is submitted by pressing the button, that parameter from the submit button is sent to the server while if the form is submitted by pressing enter from another form field, it is not, so the script will fail when checking for it. The solution is to put another hidden field like and remove the name="..." parameter from the submit tag. Teddy, Teddy's Center: http://teddy.fcc.ro/ Email: [EMAIL PROTECTED] - Original Message - From: "Hughes, Andrew" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Tuesday, April 01, 2003 6:31 PM Subject: form user interface issue I have a form that I am using to add data to a mysql database table. I am using a .pl scrtipt to generate the html. I am using cgi.pm and param() to insert the form data. And, I am using to the print< Insider's Advantage function submitIt(form) { if (!validEmail(form.check_email.value)) { alert("Invalid AOLTW Business E-Mail Address.") form.check_email.focus() form.check_email.select return false } } function validEmail(check_email) { invalidChars = " /:,;" if (check_email =="") { return false } for (i=0; i-1) { return false } } atPos = check_email.indexOf("@",1) if (atPos == -1) { return false } if (check_email.indexOf("@",atPos+1) > -1) { return false } periodPos = check_email.indexOf(".",atPos) if (periodPos == -1) { return false } if (periodPos+3 > check_email.length) { return false } return true } //end validEmail http://insidersadvantage.com/images/promotions/2003brochure/signup_head .jpg" border="0"> Please enter your work email address below so that we may determine whether or not you are an E-Club member. * Indicates a required field. Work Email Address: * checkemailform } ..snip3.. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: form user interface issue
Okay, I think that I'm getting closer. I've condensed my code so that it is a little clearer. perl decision making code: if ($choice eq "") { checkemailform(); # displays form } elsif ($choice eq "check") { checkemail(); # inserts the data } Are you suggesting this for the form?: I took the name value out of the submit input tag and included a hidden field that includes a the name choice and the value check, which is what I logic code is looking for. Do you think this is the correct path? Thanks in advance. I appreciate your "input." Thanks, Andrew -Original Message- From: Octavian Rasnita [mailto:[EMAIL PROTECTED] Sent: Tuesday, April 01, 2003 11:01 AM To: Hughes, Andrew; [EMAIL PROTECTED] Subject: Re: form user interface issue That form probably has a submit button that has a parameter name="...". The script might be checking for that param('...'). If the form is submitted by pressing the button, that parameter from the submit button is sent to the server while if the form is submitted by pressing enter from another form field, it is not, so the script will fail when checking for it. The solution is to put another hidden field like and remove the name="..." parameter from the submit tag. Teddy, Teddy's Center: http://teddy.fcc.ro/ Email: [EMAIL PROTECTED] - Original Message - From: "Hughes, Andrew" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Tuesday, April 01, 2003 6:31 PM Subject: form user interface issue I have a form that I am using to add data to a mysql database table. I am using a .pl scrtipt to generate the html. I am using cgi.pm and param() to insert the form data. And, I am using to the print< Insider's Advantage <!-- .main {font-family: Arial, Helvetica, sans-serif; font-size: 12px; font-style: normal; font-weight: normal; color: #00;} .mainsmall {font-family: Arial, Helvetica, sans-serif; font-size: 10px; color: #00;} .head {font-family: Arial, Helvetica, sans-serif; font-size: 14px; font-weight: bold; color: #00;} --> function submitIt(form) { if (!validEmail(form.check_email.value)) { alert("Invalid AOLTW Business E-Mail Address.") form.check_email.focus() form.check_email.select return false } } function validEmail(check_email) { invalidChars = " /:,;" if (check_email =="") { return false } for (i=0; i<invalidChars.length; i++) { badChar = invalidChars.charAt(i) if (check_email.indexOf(badChar,0) > -1) { return false } } atPos = check_email.indexOf("@",1) if (atPos == -1) { return false } if (check_email.indexOf("@",atPos+1) > -1) { return false } periodPos = check_email.indexOf(".",atPos) if (periodPos == -1) { return false } if (periodPos+3 > check_email.length) { return false } return true } //end validEmail http://insidersadvantage.com/images/promotions/2003brochure/signup_head .jpg" border="0"> Please enter your work email address below so that we may determine whether or not you are an E-Club member. * Indicates a required field. Work Email Address: * checkemailform } ..snip3.. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]