Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Submit form by pushing <enter>

Status
Not open for further replies.

newphpbie

Programmer
Oct 17, 2003
110
GB
I have a user search form. THe user can search records with one criteria. When they have entered the searching criteria they must click on the submit button to perform the search.

As it is now, if the user enters the serach criteria and pushes <enter> the search doesn't go through... it will only work if they click on the Submit button.

What I would like to know is if there is a way to link the submit button with the input box so when they have entered the criteria they can just push <enter> and this will 'click' the submit button.

I know about tabindex which is very very smiilar to what I want to do, but it doesn't do the job.

Does anyone understand what I'm trying to acheive with this, and can you help??

TIA

tony
 
Have you built the page using Visual InterDev? This usually gives you this problem. If you just make the page in Dreamweaver or Notepad or something along those lines you shouldn't have a problem, providing both the Submit button and Textbox are surrounded by the same Form tag.

&quot;Life is like a Ferrari, it goes to fast.
But that's ok, because you can't afford it anyway&quot; - Jim Davis (Garfield)
 
I've hard coded it all myself on a notepad doc.

Checked my coding and made sure it's all within the <form> tag but still no change...

Any other suggestions???
 
This is a bit of my code....

I've tried mvoing the last</input> tag to after the submit button, but still no joy.

Code:
echo '<form method=&quot;POST&quot; action=&quot;'.$PHP_SELF.'&quot;>';
echo '<select name=&quot;searchby&quot;>';
echo '<option value=&quot;Outlet&quot;>Outlet</option>';
echo '<option value=&quot;Cardport&quot;>Card Port</option>';
echo '<option value=&quot;Extnum&quot;>Ext Num</option>';
echo '</select><br><br>';
echo 'Search Field: <br><input type=&quot;Text&quot; name=&quot;searchitem&quot;></input><br><br><br>';
echo '<input type=&quot;Submit&quot; name=&quot;submit&quot; value=&quot;SEARCH&quot;></form><br><br>';

Any more idea's?
 
You may find it more beneficial to post this in a PHP board. I have never used PHP so couldn't comment i'm afraid. I presumed you were using HTML as this is the HTML forum.

&quot;Life is like a Ferrari, it goes to fast.
But that's ok, because you can't afford it anyway&quot; - Jim Davis (Garfield)
 
Yeah sorry, it is an html question...but it's surrounded by php code, so it might be a php Q aswell...

I'll try in there...thanks for your help anyways...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top