[ 
https://issues.apache.org/jira/browse/WICKET-5311?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13756039#comment-13756039
 ] 

Martin Grigorov commented on WICKET-5311:
-----------------------------------------

It appears that at some point (around year 2007) #setNullValid() was actually 
using #setRequired().

With

commit e3bd9d3d8a1103b0c69fe6301be7e95630ff1066
Author: Eelco Hillenius <[email protected]>
Date:   Tue Apr 10 04:29:44 2007 +0000

    rolled back deprecation of nullValid
    
    git-svn-id: 
https://svn.apache.org/repos/asf/incubator/wicket/branches/wicket-1.x@527016 
13f79535-47bb-0310-9956-ffa450edef68

Eelco reverted this. 
The commit message doesn't specifies the concrete reason and/or the respetive 
ticket, unfortunatelly.
                
> 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
>
> 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

Reply via email to