Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

HTML qn=== Urgent!!!

 
Shreya Menon
Ranch Hand
Posts: 285
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I have a jsp (test.jsp) with a form having a single text box,
Now I focus the text box and click enter button of the key board and I am seeing, my page(test.jsp) getting called again.
This is the code
<FORM >
<INPUT size="20" type="text">
</FORM>
Now instead of having one text box, if I have 2 textboxes, then my page wont be called again and again..
What is the difference here and how do I make my test.jsp with a single text field not to do resubmits ???
Please help
Maya
 
Eric Pascarello
author
Rancher
Posts: 15385
6
 
Randall Twede
Ranch Hand
Posts: 4439
3
Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Al,
interesting, but i don't think that is exactly what he/she meant since the form has neither a submit or a reset button.
maya,
what could that form possibly be for? it has no way to submit it and no action to do if there was a submit.
to answer your question as best i can, i dont know exactly why it acts that way, but if you added a hidden field to your form with only one text element it should act like the second form

<FORM >
<INPUT size="20" type="text">
<input type="hidden">
</FORM>

[ August 27, 2002: Message edited by: Randall Twede ]
 
Shreya Menon
Ranch Hand
Posts: 285
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Randell,
I tried adding a hidden object before posting this, still it doesnt work!!!
My actual page has an image instead of a Submit button, with an href to the action page. But according to the requirements, the users want to submit the form, both by pressing the enter key and by pressing the image button.
When I press the image, the form doesnt get submitted, but when I press enter key, the form gets submitted..
Any idea of how do I prevent the form getting submitted.... ???
Al, Thanks for the link, but it doesnt solve the problem this time.. any other suggestions
Maya
 
SJ Adnams
Ranch Hand
Posts: 925
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In a form with one text field the return key is treated as a submit. With more than one text box the return key does not do anything - you must add a handler.
If you want to use a submit key as well as return take a look at
www.investext.com, click login, then view source.
look at the getRetPress(e) code & adapt to suit.
Simon
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic