[html-formfu] Element::Button and its value

Mario Minati mario.minati at googlemail.com
Tue Jun 9 22:36:56 GMT 2009


Hi Ferruccio,

you probably need to set the indicator according to this post on the ML:
http://lists.scsys.co.uk/pipermail/html-formfu/2007-August/000264.html

Greets,

Mario Minati


Am Dienstag 09 Juni 2009 12:35:25 schrieb Ferruccio Zamuner:
> Sorry for my late night post, but I don't understand why:
>
> in my catalyst actions:
>
> ...
> EDIT:
> {
>           my $form = $c->stash->{form};
>           if ($form->submitted_and_valid) {
>               $c->log->debug("form->param_value('cancel')" .
> Dumper($form->param_value('cancel'))); last EDIT if
> ($form->param_value('cancel'));
> ...
> }
>
> output:  HTML::FormFu::Literal=ARRAY(0x2e25e730)
> and goto last EDIT
>
> with following params:
>
> .-------------------------------------+------------------------------------
>--.
>
> | Parameter                           | Value                              
> |  |
>
> +-------------------------------------+------------------------------------
>--+
>
> | first_name                          | Ferruccio                          
> |     | last_name                           | Zamuner                      
> |        | picture                             |                           
> |           | profile                             | test                   
> |             |
>
> '-------------------------------------+------------------------------------
>--'
>
> while following test pass:
>
>
> use strict;
> use warnings;
>
> use Test::More tests => 4;
>
> use HTML::FormFu;
>
> my $form = HTML::FormFu->new;
>
> my $submit_cancel =
> $form->element('Submit')->name('cancel',{value=>'CANCEL'}); my $submit_save
> = $form->element('Submit')->name('save',{value=>'OK'});
>
> # NOT SUBMITTED
> {
>     ok( !$form->submitted );
> }
>
> # NO INDICATOR, SUBMITTED
> {
>     $form->process( {
>             save => 'OK',
>         } );
>
>     ok( $form->submitted );
>     ok ($form->param_value('save'), 'save button submitted');
>     ok (!($form->param_value('cancel')), 'cancel button not submitted');
> }
>
> exit 0;
>
>
> ---
>
> Now I've fixed the web app, using $c->req->param('cancel')
>
> Are 'Submit' buttons to be test in some other way than
> $form->param_value() ?
>
>
>
> Bye,             \fer
>
> _______________________________________________
> HTML-FormFu mailing list
> HTML-FormFu at lists.scsys.co.uk
> http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/html-formfu





More information about the HTML-FormFu mailing list