You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by "Cedric Gatay (JIRA)" <ji...@apache.org> on 2013/08/16 22:31:48 UTC

[jira] [Commented] (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:comment-tabpanel&focusedCommentId=13742573#comment-13742573 ] 

Cedric Gatay commented on WICKET-5311:
--------------------------------------

I don't think the (any) choice needs to be added when setRequired is false. The choice is not mandatory, however, if does not imply that the any choice should exist. This is what the setNullValid() is made for.

I think we need to check if the case setNullValid(true) && setRequired(true) yells at us when validating, I thought I used it before (it is quite absurd to do so anyway, you can only chose values in the dropdown list, so any selected value is valid and fulfill the required assertion).
                
> 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