[jifty-devel] Two questions about Actions
Agostini yves
agostini at univ-metz.fr
Mon Dec 11 10:15:33 EST 2006
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
% my $create = Jifty->web->new_action(class => 'CreateGroupe');
<select name="<% $create->form_field_name('group_name') %>">
% while (my $item = $groupe->next) {
<option value="<% $item->id %>"> <% $item->name %>
% }
see 'form_field_name' to preserve continuation
>
> 2. Is there an example for autocompletion anywhere? I figured it
> would be an attribute of an Action parameter (similar to ajax
> validates), but it seems I am way off base.
>
I've just working with
here my first working test :
use Jifty::Action schema {
param search =>
autocompleter is \&ldap_search;
};
sub ldap_search {
my $self = shift;
my $search = shift;
my @res;
if (length $search > 2) {
push @res, $search.' 1';
push @res, $search.' 2';
}
return @res;
}
--
Agostini yves <agostini at univ-metz.fr>
More information about the jifty-devel
mailing list