Forum Moderators: phranque

Message Too Old, No Replies

button default

         

aditogs

1:54 pm on Dec 19, 2007 (gmt 0)

10+ Year Member



Hi,

I have two buttons on one page - one that searches the site for the keyword, and one that submits a feedback form.

When users are finishing the form they smash teh return button on their keyboards, and the top button then springs into action - giving them a "No matching records for keyowrd """ message instead of sending the feedback form.

Is there any simple way of naming the button that should be pressed should a user click return?

coopster

10:32 pm on Mar 4, 2008 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Clicking return? You cannot click the return button. Some operating systems will activate a non-click action [webmasterworld.com] such as a keyboard event though.

phranque

7:34 am on Mar 5, 2008 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



i can't remember if it's the first form on the page that gets submitted or the one with the focus or maybe it's browser dependent.
i would try doing something with the onkeypress event.

Beagle

2:29 am on Mar 6, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Clicking return? You cannot click the return button.

I'd assume this is talking about the "Enter" key, which would be the key that those who need to be able to do everything via keyboard would normally use to complete an action? So what's happening basically is that it's completing the wrong action? (No solution for you, I'm afraid - just trying to clarify the problem.)

daveVk

3:56 am on Mar 6, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



onkeypress="return false" on search button should do trick.

Alternatively or as well, give submit button focus so that enter key activates submit.