This week's book giveaway is in the Programmer Certification forum.
We're giving away four copies of OCP Oracle Certified Professional Java SE 21 Developer Study Guide: Exam 1Z0-830 and have Jeanne Boyarsky & Scott Selikoff on-line!
See this thread for details.
  • 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
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

Enter Key & submit

 
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I was wondering if anyone could help with what is probably a simple thing, but my brain is fried at this point. I'm not sure if it's an html or js issue.
I have a screen (one form) that displays a text field and a 'search' button, among other things. When I click the 'search' button all works great. When I enter a value in the text field and hit enter with focus still in the input field I was expecting the 'search' button action to be executed -- it is not. But if I click on the screen anywhere after the search button and hit enter, it submits as though search was clicked.
The following is a partial snippet of my html. I am using struts, hence the html:text tag.
Thanks in advance,
Annmarie
...
<html:form method="post" action="/allCompaniesListDispatchAction.do">
<table border="0" cellpadding="3" cellspacing="0" class="filter>
<tr>
<td width="126" class="filterLabel">Jump To Company</td>
<td width="50" class="filterValue">
<html:text property="jumpToCompanyIdInput" value="" size="10" maxlength="10" styleClass="filterValue" on k eypress="capitalize;" />
</td>
<td width="73" class="filterLabel>
<input type="image" name="" id="search" src="search_green.gif"
on click="setValues('search', jumpToCompanyIdInput.value);"
width="73" height="22">
</td>
<td><img src="spacer.gif" width="10" height="1"></td>
</tr> </table> ....
</html:form>
 
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
if you want to use the enter key you are going to have to use a onSubmit of the form tag. Here is the basic idea.

<form name="blah" onSubmit="return jsFunction()">
your script would be
function jsFunction(){
//your code andyou need to return true or false
//return false
//return true
}
 
Annmarie Ziegler
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks. I do have a onSubmit on the form ... I'll try again.
am
 
He was giving me directions and I was powerless to resist. I cannot resist this tiny ad:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic