Jump to content

Hitting Enter Key / Clicking button to submit form


This topic is 7352 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

This is an annoying problem I've never fixed:

When searching, after entering their search criteria, if a visitor hits the enter key instead of clicking on the Find button it doesn't work but comes up with 'Page Cannot be Found'

I seem to remember looking at this a while back and was advised then to add a piece of code which made hitting the enter key work but stopped clicking on the 'Find All' button (which I want to keep) from working.

Is there a method of making the Enter key submit the request whilst still allowing a visior to click 'Find All' instead?

or if not,

is there a method of suppressing hitting Enter from submitting the request?

For an example of a page in question:

www.peterborough-education.org/Schools and click on 'Schools Database'

Many thanks for your help.

Posted

Thanks, but I think this is what was suggested last time.

It makes the page "default" to the 'Find All' button - it's selected when the page loads - rather than the 'Search' button which does solve the problem of a 'Page cannot be found error'

*BUT DOESN'T* solve the problem of a person who types in a search criteria then hits enter - this justs performs a Find All again - they still have to actually click on the button.

The only way I managed to get it to search by hitting enter was to first type in my search, then click outside the text box so it wasn't selected (i.e. cursor wasn't flashing in it!)then hit enter!!!! Why should it only work if this is done???

There must be a solution??

http://216.168.37.92/peterb/Schools/search.htm if you want to check it out - it has the additional line.

Thanks again smile.gif

Posted

The logic is that the "name" of the "submit" tag will only be added to the submitted form if that button is clicked. The "hidden" tag will always be submitted.

Try this line instead, it may be closer to the desired procedure:

<input type="hidden" name="-find">

You could use just "-find" and some Javascript. If the search field is empty the Javascript will insert an "*". This should have the same effect as a "-findall".

All the best.

Garry

This topic is 7352 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.