[html-formfu] pre-check radio button

Carl Franks fireartist at gmail.com
Thu Nov 1 15:13:55 GMT 2007


On 01/11/2007, kewei xiao <kewei.xiao at nald.ca> wrote:
> Hi Carl
>
>     I am not sure how I should do in yaml file when I want the radio
> button to be checked by default at some situation.
>
>     for example, if I go to update page, i want the associated items to
> be checked when the form is load up, so user can know what's in the database
>
>     I was trying to do something like this:
>
>
>        default: { "if ( $c->stash->{variable}->item_id == this.id ) {
> checked }" }
>
>    am I doing right?  Please advise, thanks

No, you can't have Perl code in a YAML file.

If you're using DBIx::Class, then fill_formfu_value() in
DBIx::Class::HTML::FormFu will do what you want.
If not, then you could copy the approach it uses:
http://html-formfu.googlecode.com/svn/trunk/DBIx-Class-HTML-FormFu/lib/DBIx/Class/HTML/FormFu.pm

Carl



More information about the HTML-FormFu mailing list