• 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:

Controling Submit

 
Ranch Hand
Posts: 2286
2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have a form with several user input boxes. The form also has a submit button. How can I keep the form from being submitted if the user presses the enter keyboard button while in one of the text boxes. I just want the submit to happen if the submit button is clicked.
[ May 23, 2007: Message edited by: Bear Bibeault ]
 
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
Replace the submit button with a regular button. Set up the onclick handler for the button to submit the form under JavaScript control.
 
Ranch Hand
Posts: 387
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi Steve,

Can I ask you why you don't want people to hit the <enter> key?
I'm really curious.

Herman
 
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
u can also use alert box or can even put sone validations for the text box so that even if the enter button is clicked the user will remain on the same page because of not submitting the certain fields


 
Bear Bibeault
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
Abhishek Dhar,

"u" is not a word. Please use only real words such as "you" when posting to the forums.

bear
JavaRanch Sheriff
reply
    Bookmark Topic Watch Topic
  • New Topic