[
http://www.avoka.com:8080/jira/browse/CLK-451?page=all ]
Bob Schellink updated CLK-451:
------------------------------
Attachment: populate-on-select2.rar
Ok I see what you are trying to do. You are depending on the fact that 1.4 fires the listeners while processing the Control.
In 1.5 we have upgraded to a two phase event handling approach. The JIRA explaining the issues with 1.4 is here -> CLK-365
In layman's terms the listeners are only invoked after all Controls have been processed. In 1.4 the listeners were fired directly as part of the onProcess event and it was possible to create a chain of listener events.
However best practice has always been to build up your Controls in the onInit phase.
Attached is a second example (populate-on-select2.rar) of how one can achieve what you want. The tricky part of this example is how do you know which Select was changed? In the example I manually invoke select#bindRequestValue in the onInit phase to check if the Control has a value. Or one could query the Context -> String stateValue = getContext().getRequestParameter(state.getName());
The last tricky thing is that if a parent Select is changed a second time one should reset the child select. In the attached example I used some Javascript to reset the Select field.
Will also add to the official examples.
Hope this helps
> Bad Behavior with Linked Select List
> ------------------------------------
>
> Key: CLK-451
> URL:
http://www.avoka.com:8080/jira/browse/CLK-451> Project: Click
> Issue Type: Bug
> Components: core
> Affects Versions: 1.5 RC2
> Environment: Linux Apache mySQL
> Reporter: Christophe FOIRET
> Priority: Blocker
> Attachments: populate-on-select.zip, populate-on-select2.rar, PopulateOnSelectPage.java, selectListe.doc
>
>
> The behavior of linked Select List is disrupted with the 1.5 version.
> I use the following code to triggers the display of the second List from the first List and now it doesn't work any more !
> themeSelect.setListener(this,"onChangeTheme");
> themeSelect.setAttribute("onChange","form.submit()");
> ...
> public boolean onChangeTheme() {
> if (!themeSelect.getValue().equals("0") && !themeSelect.getValue().equals("")) {
> List<Atelier> listAtelier = new AtelierDAO().findByTheme(new Integer(themeSelect.getValue()));
> atelierSelect.setListener(this,"onChangeAtelier");
> atelierSelect.setAttribute("onChange","form.submit()");
> atelierSelect.add(new Option(0,""));
> atelierSelect.addAll(listAtelier,"id","libelle");
> atelierSelect.setRequired(true);
> ....
> See the copy screen attached below and the source code
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://www.avoka.com:8080/jira/secure/Administrators.jspa-
For more information on JIRA, see:
http://www.atlassian.com/software/jira
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/_______________________________________________
Click-development mailing list
Click-development@...
https://lists.sourceforge.net/lists/listinfo/click-development