Advertisement

10.09.2008 at 02:12PM PDT, ID: 23802515 | Points: 250
[x]
Attachment Details

I have an ASPX page with a single text box and one submit button. Sometimes a submit occurs on keypress of the Enter key (which is what I want), and sometimes it doesn't.

Asked by dkcc in Programming for ASP.NET, JScript

I have an ASPX page with a single text box and one submit button. When I enter a zip code into the text box and press the Enter key, the page just reloads. However, if I remove the focus from the text box by clicking somewhere else on the page and then press the Enter key, the submit occurs and the next page loads as I want.

Code Snippet:
<INPUT name="yourZipCode">
<INPUT onclick="validateForm(this.form, '/nextpage.aspx');return false;"   id="buttonid" type="submit" value="NEXT" name="homeFind">

I have tried writing a custom onkeypress event handler to catch the Return keypress and then click the button in the event handler using   document.getElementById("buttonid").click();  
but result is the same.

I am using ,NET Framework 1.1Start Free Trial
[+][-]10.09.2008 at 11:14PM PDT, ID: 22684611

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]10.10.2008 at 06:19AM PDT, ID: 22686541

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]11.18.2008 at 07:28PM PST, ID: 22991250

Experts Exchange has a courteous staff of administrators who help members get the most out of the website by means of administrative comments like this one.

Start your 7-day free trial to view this Administrative Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 - Hierarchy / EE_QW_2_20070628