[html-formfu] <input> and <button>

Carl Franks fireartist at gmail.com
Thu Nov 27 12:45:43 GMT 2008


2008/11/27 Ben Vinnerd <ben-formfu at vinnerd.com>:
> Hi,
>
> I used Element::Button({type => 'submit'}) in the hope that it would return
> a <button>, but instead i got <input type="submit">
>
> Is this the correct behaviour?
>
> Is the only way to get a <button> to workaround by using Element::Block
> instead?

xhtml defines 2 types of buttons:
    <input type="button" />
and
    <button></button>

The FormFu element creates the first of those.
You could use a Block to fake the 2nd, but FormFu won't receive any
value for it, as a Block isn't a field, as far as FormFu is concerned.
So it will only work if:
* it's being used as a submit button
* there's at least 1 other field/value so FormFu can tell the form's
been submitted
* you don't need the button's value

A proper solution would be to create a new field element, which also
has the Block's content() methods.
Though I'm not sure what it would be called, as Button's already taken.

However, I'm confused by what you're saying with:
    Element::Button({type => 'submit'})

How are you actually creating the element?
Because if you're creating a Button element...
    $form->element({ type => 'Button' });
how can you also be setting "type => 'submit'" ?

Carl



More information about the HTML-FormFu mailing list