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

Ben Vinnerd ben-formfu at vinnerd.com
Tue Dec 2 21:09:03 GMT 2008


I have just discovered ContentButton - that does the trick :)

    $form->element({
        type       => 'ContentButton',
        field_type => 'Submit',
        name       => 'submit',
        content    => 'Submit',
    });

I can now change the content to an image, or whatever i like :)

Ben


Carl Franks wrote:
> 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
>
> _______________________________________________
> HTML-FormFu mailing list
> HTML-FormFu at lists.scsys.co.uk
> http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/html-formfu
>   



More information about the HTML-FormFu mailing list