There's no reason you can't do your form manipulations in
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($self, $object) = @_;
my $choices = ...get $choices from $object somehow...
$self->field('my_field')->choices($choices);
# Proceed with normal init_with_object() stuff...
$self->SUPER::init_with_object($object);
}
You could also add the radio button group field in init_with_object()
if it doesn't exist, or set the choices if it does:
sub init_with_object
{
my($self, $object) = @_;
my $choices = ...get $choices from $object somehow...
# Set choices if the field already exists, otherwise add the field
if(my $field = $self->field('my_field'))
{
$self->field('my_field')->choices($choices);
}
else
{
$self->add_field(my_field =>
{
type => 'radio group',
choices => $choices,
});
}
# Proceed with normal init_with_object() stuff...
$self->SUPER::init_with_object($object);
}
-John
> There's no reason you can't do your form manipulations in
> 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():