[Catalyst] Select cascades with Prototype and Ajax
Stephan Austermühle
au at hcsd.de
Wed Feb 8 17:22:59 CET 2006
Hi,
I'm trying to implement a select cascade using HTML::Prototype and
observe_field() with only little success. What I'd like to have is:
<form id="myform" ...>
...
<select id="A" name="A" size="1">
<option value="1">Item 1</option>
...
</select>
<select id="B" name="B" size="1">
<option value="1">Sub item 1</option>
...
</select>
<select id="C" name="C" size="1">
<option value="1">Sub sub item 1</option>
...
</select>
...
[% c.prototype.observe_field('A', {url => '/my/action', with =>
"'A='+document.getElementById('A').value", update => 'B'}) %]
[% c.prototype.observe_field('B', {url => '/my/otheraction', with =>
"'B='+document.getElementById('B').value", update => 'C'}) %]
</form>
So I can select an item from drop down box A that fills drop down box B.
Now I'd like to select something from drop down box B so box C gets
filled.
This is what happens: Selecting an item from box A works, box B gets
filled. Selecting an item from drop down box B leads to nothing --
Catalyst never receives an invocation of /my/otheraction.
I also tried to use observe_form() instead of observe_field() but that
doesn't work either. When using observe_form() I can select an item from
drop down box A once, any further selection in drop down box A doesn't
cause my web browser (Firefox) to call the given URL.
Is there someout out there who can help?
Thank you!
Stephan
More information about the Catalyst
mailing list