Category Image Default Submit Action on Multiple Submit Form


This tip comes from the webobjects-dev mailing list....

"Problem: Some browsers trigger the WOForm action, whilst other trigger the first submit button action when a user hits the enter key. I've tested my test app with IE v4+, Netscape v6+, Opera and Chimera on both mac and windows and can confirm that it is a browser related issue.

After much playing about with this issue, i have decided that the best way to get the behaviour i required was to add a 1x1 pixel image as an WOImageButton at the very top of my form and bind it's action to the action that I want to trigger if the user hits the enter key, and leave the form action method unbound (thanks to Pierre Bernard for this tip). This provides consistent behaviour across all browsers mentioned above. Note that i also add an extra tag to the WOImagButton of TABINDEX="" - this means that as the user tabs through the form elements it doesn't pick up on the single pixel image and hence it is completely invisible to the user."

"Problem: Some browsers trigger the WOForm action, whilst other trigger the first submit button action when a user hits the enter key. I've tested my test app with IE v4+, Netscape v6+, Opera and Chimera on both mac and windows and can confirm that it is a browser related issue.

After much playing about with this issue, i have decided that the best way to get the behaviour i required was to add a 1x1 pixel image as an WOImageButton at the very top of my form and bind it's action to the action that I want to trigger if the user hits the enter key, and leave the form action method unbound (thanks to Pierre Bernard for this tip). This provides consistent behaviour across all browsers mentioned above. Note that i also add an extra tag to the WOImagButton of TABINDEX="" - this means that as the user tabs through the form elements it doesn't pick up on the single pixel image and hence it is completely invisible to the user."

Posted: Tuesday - April 25, 2006 at 08:51 AM        


Published by