[html-formfu] How to restore information for the confirm page?
Hu Hailin
i at h2l.name
Thu Nov 27 03:50:59 GMT 2008
Example:
------------------------------
#!/usr/bin/perl
use strict;
use warnings;
use HTML::FormFu;
use YAML::Syck qw( Load );
use Data::Dumper;
my $form = HTML::FormFu->new;
my $yaml = do { local $/; <DATA> };
my $data = Load($yaml);
$form->populate($data);
$form->process({
name => 'Zhang San',
city => 1,
});
print Dumper $form->params;
print Dumper $form->render;
__DATA__
---
auto_fieldset: 1
elements:
- type: Text
name: name
label: Your name
- type: Select
name: city
label: Your city
options:
- ['1', 'Shanghai']
- ['2', 'Beijing']
------------------------------
what i am expecting is something like
$params_for_humans = {
'Your name' => 'Zhang San',
'Your city' => 'Shanghai'
};
or
$form->render_with_all_elements_disabled
However, how do you guys handle the confirm page generally?
On Thu, Nov 27, 2008 at 3:32 AM, Carl Franks <fireartist at gmail.com> wrote:
> 2008/11/26 Hu Hailin <i at h2l.name>:
>> Hi,
>>
>> a form submitting is often used in such a way:
>> input -> confirm -> result
>>
>> for app, $form->params is enough.
>>
>> but, at the confirm page, it is expected to display the information
>> again for customers.
>> is it possible to implement something like $form->params_for_human?
>
> I'm not sure what you're asking for.
> $form->params() returns a data structure.
> What are you suggesting params_for_human() should return?
>
> Are you meaning something comparable to $form->render(), which returns
> XHTML, but as just labels/values, rather than form fields?
>
> Carl
>
> _______________________________________________
> HTML-FormFu mailing list
> HTML-FormFu at lists.scsys.co.uk
> http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/html-formfu
>
--
islue
More information about the HTML-FormFu
mailing list