[Html-widget] Select fields and '0' value - again

Carl Franks fireartist at gmail.com
Fri Sep 8 14:56:32 CEST 2006


On 07/09/06, Tobias Kremer <t at funkreich.de> wrote:
>
> if you set
> the initial value to '1', mock the request to '0' and process the form.
> It then jumps back to '1'.

okay, I see the problem.

I've come across this in the past, when a form is shown to the user
again to correct invalid values.
I 'fixed' it with the hack...
$element->value( $result->params->{$_} ) if $result->valid( $_ );

I tried changing Widget.pm so that valid values are passed on to all
elements in result(), but as expected, this caused a lot of failed
tests.
I suspect that all the failed tests were cases where the HTML is
compared, rather than using methods to test for expected values - so
it's impossible to say whether someone's relying on the current
behaviour.
(Which is why testing the HTML output sucks)

I agree that the current behaviour is b0rken, though.
Anyone else have any thoughts on this?

Carl



More information about the Html-widget mailing list