HTML::Widget::Element::Button has a retain_default() accessor.

<cite>
If true, overrides the default behaviour, so that after a field is 
missing from the form submission, the xml output will contain the 
default value, rather than be empty.
</cite>

But why?

A button value (the label) cannot or at least should not be changed by 
the user (see bottom of page) - or do I overlook something?

I ask because I struggled some time with HTML::Widget to find out why a 
submit button of a form didn't get a value. Finally I found the reason 
is because for the corresponding form I always call process with the 
HTTP request object as argument -

        $widget->process($c->request)

- even at the initial call (*).

I set retain_default(1) on this submit element now and it works, but 
actually as I said I think retain_default() is unappropriate for a 
button element and in HTML::Widget::Element::Button::containerize() the 
line
        and $self->retain_default || not $args->{submitted};

should be removed.


(*) To set and check initial form values. Thus currently (and without 
retain_default(1)) I'm also able to set the value of the submit button 
(the name is also "submit") by calling the page like this:

http://my.domain/path/to/page?submit=My+Personal+Search-Button

Does anybody need or want this behaviour?
-- 
Bernhard Graf

_______________________________________________
Html-widget mailing list
Html-widget@lists.rawmode.org
http://lists.rawmode.org/cgi-bin/mailman/listinfo/html-widget

Reply via email to