From: John Siracusa <sirac...@gmail.com>
Date: Sun, 3 May 2009 08:20:55 -0400
Local: Sun, May 3 2009 8:20 am
Subject: Re: Customised choices in form element?
On Sun, May 3, 2009 at 4:41 AM, James Masters <ja...@mastersgames.com> wrote: There's no reason you can't do your form manipulations in > I have a form that works nicely but I would like to add a Radio Button > field to it with the choices taking values that are dependent upon the > database object that is initialised with the form. The choices hash > can be generated easily given the database object. But I suppose that > since the form is generated with the following 2 lines, the only way > for this to work would be if I could pass the $dbobj to the "new" > method somehow. > my $form = $formclass->new; > Is this possible? I suppose another way (although less preferable for init_with_object(). Just have your radio button group field ("my_field") all ready and waiting in the form, then set the choices in init_with_object(): sub init_with_object my $choices = ...get $choices from $object somehow... $self->field('my_field')->choices($choices); # Proceed with normal init_with_object() stuff... You could also add the radio button group field in init_with_object() sub init_with_object my $choices = ...get $choices from $object somehow... # Set choices if the field already exists, otherwise add the field # Proceed with normal init_with_object() stuff... -John You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
| ||||||||||||||