You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by "Sven Meier (JIRA)" <ji...@apache.org> on 2017/06/21 17:37:00 UTC
[jira] [Resolved] (WICKET-6403) DropDownChoice ignores
OnChangeAjaxBehavior while setting null value when required is true
[ https://issues.apache.org/jira/browse/WICKET-6403?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Sven Meier resolved WICKET-6403.
--------------------------------
Resolution: Invalid
Assignee: Sven Meier
I've added some javadoc to #onUpdate.
Thanks!
> DropDownChoice ignores OnChangeAjaxBehavior while setting null value when required is true
> ------------------------------------------------------------------------------------------
>
> Key: WICKET-6403
> URL: https://issues.apache.org/jira/browse/WICKET-6403
> Project: Wicket
> Issue Type: Bug
> Affects Versions: 8.0.0-M6
> Reporter: Kamil
> Assignee: Sven Meier
>
> I have a simple DropDown with OnChangeAjaxBehavior:
> {code}
> List<String> choices = Arrays.asList("one", "two", "three");
> IModel<String> wicketModel = Model.of();
> DropDownChoice<String> wicketDropDown = new DropDownChoice<>("wicketDropDown",wicketModel , ListModel.of(choices));
> wicketDropDown.add(new OnChangeAjaxBehavior() {
> @Override
> protected void onUpdate(AjaxRequestTarget target) {
> System.out.println("Wicket change: "+wicketModel.getObject());
> }
> });
> add(wicketDropDown);
> {code}
> onUpdate is called everytime I change the value *even if this value is "null value"*.
> Now when instead of:
> {code}
> add(wicketDropDown);
> {code}
> I set:
> {code}
> add(wicketDropDown.setRequired(true));
> {code}
> onUpdate works on selecting values but *does not work when selecting "null value"* which is wrong.
> One of the use cases why it is wrong: I have two dropdowns. First dropdown selects _Group_ and second selects _Subgroup_. _Subgroup_ can not be selected if _Group_ is null, though if I select _Group_, then I select _Subgroup_ and then clear the _Group_ - _Subgroup_ should be cleared as well (but I'm not able to do that because onUpdate is not being called).
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)