Hi.
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".
Here is the content of a minimal example (attached), hopefully
illustrating the problem:
my $widget=HTML::Widget->new('mywidget');
$widget->element('Submit', 'update')->value('Update');
$widget->element('Submit', 'preview')->value('Preview');
my $q=MyParam->new({ update=>'Update' });
my $result=$widget->process($q);
print $result->as_xml;
The form has two buttons, "Update" and "Preview". The $q simulates that
the "Update"-button was clicked.
The result, if displayed, looks like this:
.--------. .--------------.
| Update | | Submit query |
`--------' `--------------'
Which looks odd.
In 1.07 it looks fine: "Update" "Preview".
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?
Best regards,
Adam
--
Adam Sjøgren
adsj@xxxxxxxxxxxxx
#!/usr/bin/perl
use strict;
use warnings;
use HTML::Widget;
my $widget=HTML::Widget->new('mywidget');
$widget->element('Submit', 'update')->value('Update');
$widget->element('Submit', 'preview')->value('Preview');
my $q=MyParam->new({ update=>'Update' });
my $result=$widget->process($q);
print $result->as_xml;
package MyParam;
sub new {
my ($class, $values)=@_;
return bless { %$values }, $class;
}
sub param {
my ($self, $key)=@_;
return defined $key ? $self->{$key} : keys %$self;
}
_______________________________________________
Html-widget mailing list
Html-widget@xxxxxxxxxxxxxxxxx
http://lists.rawmode.org/cgi-bin/mailman/listinfo/html-widget
|
Try Searching:
servers, voip, java, networking, microsoft ...
|
|
|
|