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

[jira] [Updated] (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 ]

Karel Krajca updated WICKET-5311:
---------------------------------

    Description: 
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.

  was:
In my opinion, there is a 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.

    
> 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