Page submitting Problem while pressing ENTER key

liunx

Guest
Hai,

After providing all the values in the form, by clicking the "SUBMIT" button, the form got submitted successfully. But It should get submitted by pressing the ENTER Key instead clicking the SUBMIT button. Is is working in some forms and not working in some other forms.

I don't know the reason. Kindly explain the reason and suggest me to submit the form by pressing "ENTER" key.

This problem is in VB.Net project.

Thanks and regards,
Siva RThe problem is most likely that the click event of the first button on your form is fired when the enter key is pressed rather than the button you intended.

ASP .Net web sites run into this problem frequently because there are usually a few buttons on a page. Maybe a search box and search button at the top of each page and say a submit button for a feedback form in the body of the page. So, when a user fills the feedback form and then presses the enter key while focused on the last feedback textbox, the search button is actually clicked rather than the submit button for the feedback form.

You might think that you could just use multiple <form>s, but ASP+ only allows 1 form. I have seen a custom web control called Wilson forms or something similar that boasts the ability to have multiple forms on a single page. However, it isn't free and is probably too complex to be worth it in your situation.

So, what I would recommend is that you do a google search on "javascript enter key". That will give you dozens of sites that will show you how to bind form elements to a particular button. Since it uses JS, you aren't gauranteed 100% usability for end users, but it will help quite a few. Good luck.Thanks a lot.

SivaThis should solve your problem.
If you need more help.. MSDN has great help :)
 
Back
Top