• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Paul Clapham
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Roland Mueller
  • Piet Souris
Bartenders:

Pressing enter key submits page

 
Ranch Hand
Posts: 81
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have a html:text box in my page. But when i press enter key in text box it submits page. I dont want the page to get submitted.

I have also used html:file in the same form.

Please let me know what could be the problem.
 
Sheriff
Posts: 67756
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
There's no problem -- that's the way forms work in HTML. If there is a submit button on the form, a return in any field will cause the button to trigger.

If that's not what you want, you can either replace the submit button with a non-submit button and use it to submit the form under JavaScript control, or you can establish an event handler on the form that captures the key event and blocks submission
 
reply
    Bookmark Topic Watch Topic
  • New Topic