Discussion:
[jifty-devel] canonicalize / defer
Felix Abraham
2008-06-10 09:36:05 UTC
Permalink
Hi,

I am trying to build a form with two select boxes. The second one
should only show values depending on the value selected in the first
one. I tried to use ajax canonicalize with the first select and defer
with the second, but that didn't work out. What would be a sensible
approach for this?

Thanks for your help,

Felix
Edward Funnekotter
2008-06-10 15:35:32 UTC
Permalink
I am sure there are cleaner ways to do this, but one that has worked
for me was to use the 'onchange' attribute within the form field of
the first select box to cause a region refresh that includes the
second select box, containing the filtered results.

Here is an excerpt of my template that does this. It is not exactly
the same as what you want, but it should show the concept:

--- snip ---

%# Add the resource type select
% my $rtSelect = Jifty->web->new_action(class => 'ResourceTypeSelect',
moniker => 'select_rt');
<% $rtSelect->form_field('select_item',
onchange => {submit => $rtSelect,
args => { show_fields => 1,
}
} )%>

% if ($show_fields && ($rtSelect->argument_value('select_item') ne
"--Select--")) {
--- do stuff differently here if an item has been selected.
}
--- snip ---
Post by Felix Abraham
Hi,
I am trying to build a form with two select boxes. The second one
should only show values depending on the value selected in the first
one. I tried to use ajax canonicalize with the first select and defer
with the second, but that didn't work out. What would be a sensible
approach for this?
Thanks for your help,
Felix
_______________________________________________
jifty-devel mailing list
http://lists.jifty.org/cgi-bin/mailman/listinfo/jifty-devel
Loading...