ah, but see my tweak

now when we look for a submit button and not find one i also check for the
default button. so if you do manage to somehow bypass the hidden field and
submit the button it should still work.

the "problem" i see for this is if you have the default button set and
submit the form using javascript form.submit(); but then i dont know if you
really do want the default button called or not, i think you still do.

also what i did is always move the button off screen instead of making it
display:none. maybe some browsers do not let you submit using hidden
buttons.

-igor


On 2/2/07, Eelco Hillenius <[EMAIL PROTECTED]> wrote:

On 2/2/07, netfork <[EMAIL PROTECTED]> wrote:
>
> test example abracadabra, also can't call default button' onSubmit
method.
>
> Screenshot:
> http://www.nabble.com/file/6211/screenshot2.gif

That does work for me though...

The javadoc of setDefaultButton reads:

        /**
         * Sets the default button. If set (not null), a hidden submit
button will
         * be rendered right after the form tag, so that when users press
enter in a
         * textfield, this button's action will be selected. If no default
button is
         * set (so unset by calling this method with null), nothing
additional is
         * rendered.
         * <p>
         * WARNING: note that this is a best effort only. Unfortunately
having a
         * 'default' button in a form is ill defined in the standards, and
of course
         * IE has it's own way of doing things.
         * </p>
         *
         * @param button
         *            The button to set as the default button, or null
when you want
         *            to 'unset' any previously set default button
         */

Note the warning. The tactic I used I to put a submit button field
right after the form declaration in HTML and hide it (e.g. in the
wizard: <input type="submit" value="Next &gt;" name="buttons:next"
style="display: none" />). Unfortunately, HTML doesn't have the
concept of a default button. The heuristic in this case is that if you
press enter in a text field, most if not all browsers will choose the
first button that was defined in the form.

Doing it with javascript (catching onkeypressed or something similar)
would be too intrusive for the framework, though it might be a good
solution for your specific case.

Eelco

Reply via email to