You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Michal Prinke <bo...@icpnet.pl> on 2004/05/06 02:49:26 UTC

One fills second one on change - impossible in Tapestry?

Posted by "Kevin C. Dorff" <kd...@kcp.com>.
I believe Harish posted something like this last fall.  Search the list for
"VariablePropertySelection".

Here's the original posting:

http://article.gmane.org/gmane.comp.java.tapestry.user/2041


Kevin


Michal Prinke wrote:

> Hello,
>
> Imagine some complicated form with many input fields. Among them,
> there are two <selects> (@PropertySelections) on this form:
> "Select city" and "Select person".
>
> When www-user first enters the form, the person selector is
> empty (saying "<first select a city>"). When user selects
> some city - e.g., New York - the whole page reloads
> (due to cities.submitOnChange="true") and the person selector
> gets filled with names of people living in New York.
>
> Then, user chooses some person, fills some other fields
> and finally submits the whole form.
>
> Is it possible to get such functionality in Tapestry?
>
>
>
> I've tried:
>
> public void attach(IEngine engine)
> {
>   super.attach(engine);
>   setPersonsSelectionModel(EMPTY_PERSONS_SELECTION_MODEL);
> }
>
> public void formSubmit(IRequestCycle cycle) {
>   setPersonsSelectionModel(getPersonsSelModelByCity(getCity()));
> }
>
> ...but this leads to exception during component render.
> When a person is selected and the form is submitted, Tapestry
> tries to find the person when its selection model is not
> yet set by formSubmit() - it is still empty, as set by attach() -
> so ArrayIndexOutOfBoundsException is thrown.
>
> This does not work, also:
>
> public void attach(IEngine engine)
> {
>   super.attach(engine);
>   if (getCity() != null)
>     setPersonsSelectionModel(getPersonsSelModelByCity(getCity()));
>   else
>     setPersonsSelectionModel(EMPTY_PERSONS_SELECTION_MODEL);
> }
>
> public void formSubmit(IRequestCycle cycle) {
> }
>
> ...since getCity() returns null in attach, works only in formSubmit.
>
>
>
> Filling the second <select> through JavaScript on the client
> side is impossible, because the number of persons living in
> all the cities is simply too big.
>
> Thanks for any help...
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
>



---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


Re: One