You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Waimun Yeow <wa...@dev.java.net> on 2006/08/02 04:41:24 UTC
Auto-updating a drop-down list
Hi,
I would like to find out how I can auto-update a drop down list in a
form when another drop down list changes. For example, in a HTML
form, I have two <select> elements. Let's say the first <select> has
a list of department names and upon selecting one, it updates the
second <select> with a list of employees for the selected department.
Also, the values of the two <select> elements are retrieved from a
database table.
What is the typical approach of dealing with this type of problem? Is
there any article that explains this? I would appreciate if anyone
who has dealt with a similar problem above provide me with some
suggestions or pointers. Thanks.
-waimun
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: Auto-updating a drop-down list
Posted by Nick Westgate <ni...@key-planning.co.jp>.
Alternatively, if you want the list to change without the round-trip
to the server, check out "DynamicSelectionList(Tap 4)" on Tassel:
http://www.tapestrycomponents.org/Tassel/app?service=external/ViewComponent&sp=SDynamicSelectionList%28Tap+4%29
I've used the T3 version and it works well (with a few tweaks).
Cheers,
Nick.
Waimun Yeow wrote:
> Hi,
>
> I would like to find out how I can auto-update a drop down list in a
> form when another drop down list changes. For example, in a HTML form,
> I have two <select> elements. Let's say the first <select> has a list
> of department names and upon selecting one, it updates the second
> <select> with a list of employees for the selected department. Also,
> the values of the two <select> elements are retrieved from a database
> table.
>
> What is the typical approach of dealing with this type of problem? Is
> there any article that explains this? I would appreciate if anyone who
> has dealt with a similar problem above provide me with some
> suggestions or pointers. Thanks.
>
> -waimun
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: Auto-updating a drop-down list
Posted by Jesse Kuhnert <jk...@gmail.com>.
You can do something like the following:
-) Define your two select lists, I'll leave that part out..But let's assume
they are named listA and listB. We'll also assume that a form exists named
form1.
-) In your page or component, define a method that looks somewhat like this:
@EventListener(targets = "listA", events = "onchange", submitForm="form1")
public void listASelected(IRequestCycle cycle)
{
cycle.getResponseBuilder().updateComponent("listB");
}
More documentation can be found here,
http://tapestry.apache.org/tapestry4.1/ajax/EventListener.html.
On 8/1/06, Waimun Yeow <wa...@dev.java.net> wrote:
>
> Hi,
>
> I would like to find out how I can auto-update a drop down list in a
> form when another drop down list changes. For example, in a HTML
> form, I have two <select> elements. Let's say the first <select> has
> a list of department names and upon selecting one, it updates the
> second <select> with a list of employees for the selected department.
> Also, the values of the two <select> elements are retrieved from a
> database table.
>
> What is the typical approach of dealing with this type of problem? Is
> there any article that explains this? I would appreciate if anyone
> who has dealt with a similar problem above provide me with some
> suggestions or pointers. Thanks.
>
> -waimun
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>
--
Jesse Kuhnert
Tacos/Tapestry, team member/developer
Open source based consulting work centered around
dojo/tapestry/tacos/hivemind.