[Html-widget] Default values of Submit-elements after form-submission

Carl Franks fireartist at gmail.com
Wed Sep 27 15:07:05 CEST 2006


On 27/09/06, Adam Sjøgren <adsj at novozymes.com> wrote:
> I'm looking at the effects of upgrading an app from using HTML::Widget
> 1.07 to 1.09, and I've bumped into this in the Changelog:
>
>  - After form submission, $result->as_xml() no longer uses an elements'
>    default value if that field wasn't submitted.
>
> in relation to Submit-elements.
>
> The immediate effect of the change is that the "Save"-buttons on my
> editing pages changed to "Submit query".

> I guess one could argue that this is an artefact of HTML's abuse of
> the value attribute on input-elements of type submit for the text
> displayed on the button. Nevertheless, it used to work the way I would
> expect and now it doesn't.
>
> Should I just bite the sour apple and keep a list of my Submit-buttons
> with values and prefill my $q's with them, or what less cumbersome
> solution have I overlooked?

I can certainly see the argument for making Submit / Reset buttons
special cases, and using the default value.
Maybe leave Button elements as they are, so that there's a simple way
of creating buttons which have the behaviour of not using the default.

An alternative would be giving Submit, Reset and Button an accessor to
change the behaviour, but should that be
forget_default(1) or
retain_default(1) ?

Has anyone else been bitten by this?

Carl



More information about the Html-widget mailing list