You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by "Martin Grigorov (JIRA)" <ji...@apache.org> on 2013/09/02 15:18:52 UTC

[jira] [Resolved] (WICKET-5311) Logical collision between setRequired() and setNullValid() methods in DropDownChoice

     [ https://issues.apache.org/jira/browse/WICKET-5311?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Martin Grigorov resolved WICKET-5311.
-------------------------------------

    Resolution: Won't Fix

There was a discussion about this at the same period when Eelco made the revert:
http://mail-archives.apache.org/mod_mbox/wicket-dev/200704.mbox/%3C918312fe0704090625j366102ccv313d709753e7a680@mail.gmail.com%3E. See the following messages in this thread.

If you don't agree with its outcome (few of the Wicket core devs didn't agree at the time) then please continue the linked discussion in this ticket (section Issue links).

I personally agree with both views on this topic. 
The current way is may be confusing but it is flexible enough to cover all views.
                
> Logical collision between setRequired() and setNullValid() methods in DropDownChoice
> ------------------------------------------------------------------------------------
>
>                 Key: WICKET-5311
>                 URL: https://issues.apache.org/jira/browse/WICKET-5311
>             Project: Wicket
>          Issue Type: Improvement
>          Components: wicket
>    Affects Versions: 6.8.0
>            Reporter: Karel Krajca
>            Priority: Minor
>
> In my opinion, there is a logical collision between setRequired() and setNullValid() methods in DropDownChoice. Imagine you have an optional property A assigned a value in your model. In UI you allow the property A mapped to an instance of DropDownChoice to have its value from a list (Item1, Item2). When you adjust the instance of DropDownChoice to be DropDownChoice.setRequired(false), you expect to have ((none), Item1, Item2) in the dropdown list but in reality, you get only (Item1, Item2) choices. To have the (any) option which stands for a null value in the dropdown, you still need to set DropDownChoice.setNullValid(false).
> I would propose to automatically add the "(none)" or "any" value to DropDownChoice list when having DropDownChoice.setRequired(false).
> Another case showing that setRequired() and setNullValid() are logically contradicted is that you can set DropDownChoice.setRequired(true) and DropDownChoice.setNullValid(true) leading to have a dropdown with "(any)" option which can be selected, but don not pass the form validation.
> Thank you for your consideration of this issue which could lead you to some useful refactoring.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira