Thanks for the answers everyone.  Using defer worked perfectly for the
dynamic section set.

On 12/11/06, Nelson Elhage <[EMAIL PROTECTED]> wrote:

Isn't the right answer these days supposed to be Scalar::Defer?

param group_name =>
  label is 'Group Name',
  type is 'select',
  valid_values are defer { get_groups(); };

I don't know if it actually works yet, although I did see some commits
recently that I think were trying to fix it.

- Nelson

On Mon, Dec 11, 2006 at 10:24:49AM -0500, Jesse Vincent wrote:
>
>
>
> On Mon, Dec 11, 2006 at 04:15:33PM +0100, Agostini yves wrote:
> > Le lundi 11 d??cembre 2006 ?? 09:41 -0500, Edward Funnekotter a ??crit
:
> > > Hi,
> > >
> > > I haven't found any documentation to answer these yet (forgive me if
I
> > > missed them):
> > >
> > > 1. Is it possible to populate an Action's selection field at
runtime?
> > > What I am trying to do is have a selection box in a form that has a
> > > subset of a list of items that is dependent on the user.  I tried
the
> > > following:
> > >
> > >   param group_name =>
> > >     label is 'Group Name',
> > >     type is 'select',
> > >     valid_values are sub { get_groups(); };
> > >
> > > But it seems that giving a code ref to the valid values is not
> > > acceptable.
> >
> > I don't think it's possible in action
> > I make this yesterday by making my own html form
>
> What we've done in the past is to do this in the arguments sub. (Which,
> yes, is deprecated, but I haven't yet spent enough time with the param
> syntax to know the answer with it off the top of my head)
>
> sub arguments {
>     my $self = shift;
>     return $self->{__cached_arguments} if (exists
$self->{__cached_arguments});
>
>     my $args = $self->__get_cache->{$self->__cache_key($self->record)}
||=
>         $self->SUPER::arguments();
>
>     if (my $owner_id = $record->owner->id) {
>         $args->{'owner_id'}{'default_value'} = $record->owner->email;
>
>         if (   $owner_id == BTDT::CurrentUser->nobody->id
>             or $owner_id == $self->current_user->id )
>         {
>             $args->{'group_id'}{'valid_values'} = [
>                 {   display => (($record->group_id ?
$record->group->name : "Personal" ) . " (Unchanged)"),
>                     value   => $record->group_id,
>                 },
>                 {   display => 'Personal',
>                     value   => 0,
>                 },
>                 {   display_from => 'name',
>                     value_from   => 'id',
>                     collection   =>
Jifty->web->current_user->user_object->groups,
>                 },
>             ];
>         }
>     }
>
>     ...
>    return $args;
> }
>
>
> --
> _______________________________________________
> jifty-devel mailing list
> [email protected]
> http://lists.jifty.org/cgi-bin/mailman/listinfo/jifty-devel
_______________________________________________
jifty-devel mailing list
[email protected]
http://lists.jifty.org/cgi-bin/mailman/listinfo/jifty-devel

_______________________________________________
jifty-devel mailing list
[email protected]
http://lists.jifty.org/cgi-bin/mailman/listinfo/jifty-devel

Reply via email to