bytepusher
bytepusher

Reputation: 1578

HTML::FormHandler submit button

I have several HTML::FormHandler forms working nicely,
the only issue is the submit button, which does not change its text/label.

Here is (part of) my form, the labels for the other fields all work as expected.

    has_field username => ( type => 'Text', label => 'Username', required => 1);
    has_field name => ( type => 'Text', label => 'Name', required => 1);

    has_field submit => ( type => 'Submit', label => 'Create',do_label => 1, 
element_class => 'button' );

Now the element class is set and works, but the button shows 'save', not 'create'.

According to the docs, labels are not rendered for submit buttons unless
do_label is set, but for me, it makes no difference.

I have also tried giving a build_label method, also to no effect.

I'd be glad for any pointers on how I can achieve this using HTML::FormHandler methods, as I am using these forms quite extensively and would not like to put them in by hand.

Upvotes: 1

Views: 140

Answers (1)

Dre
Dre

Reputation: 4329

For submit fields, you need to use value and not label

Try:

has_field submit => ( type => 'Submit', value => 'Create',
    element_class => 'button' );

Source: https://metacpan.org/pod/HTML::FormHandler::Field::Submit

Upvotes: 3

Related Questions