Forum Moderators: open
I was dismayed to find that when the whap of the enter key defaults to the submit button, both the onFocus and onClick events fire for the submit button.
Now I'm playing with hiding the submit button and using a 'button button' to trigger the submit manually. Thus, if the Submit button's events fire, I know we had a whap of the enter key vs a mouse click for the button button.
Three questions:
Am I making any sense here?
Am I making more of this than I need to?
How to hide the submit button? Style="height:0px" did not do the trick.
Thanks much for ideas!
Am I making any sense here? Am I making more of this than I need to?
Only you can judge how important this is for your site/application. I personally don't take it well when clients insist on things being overly complex or non-standard...I talk them into the K-I-S-S principle.
How to hide the submit button? Style="height:0px" did not do the trick.
Have you tried style="visibility:hidden;" or style="display:none;"?
The first will keep the same document formatting, preserving the space the element takes up and the second completely removes the element from the document flow.
<input type="image" src="image.gif" border="0" name="submit">
Then you could test the values submit.x and submit.y to see if they are greater than zero. If the submit is triggered by the enter key, submit.x and submit.y will be equal to zero. (unless the pointer happens to be on the button).
But, I'm not sure if you can successfully test the x and y coordinates in JavaScript.
Don't know why I missed this the first time around, but I'm now using the mouseover/mouseout events to tell whether it's a real click on the submit.