You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by "bernard (JIRA)" <ji...@apache.org> on 2008/12/15 01:49:44 UTC

[jira] Reopened: (WICKET-1979) DropDownChoice data null if queried early

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

bernard reopened WICKET-1979:
-----------------------------


I am re-opening this for two reasons:

1) I will attach a test case for juergen that reproduces with wicket-1.4-rc1

2) I am confused by Igor's comments.  When I follow Igor's thoughts then I must conclude that  the functionality in the reference manual at http://cwiki.apache.org/WICKET/conditional-validation.html is not supported by Wicket.

I thought that conditional validation is very common, and that for testing a component for a condition, that component does not need to have its data validated.

This is especially true in the common case of a HTML select  field that has only valid entries.

> DropDownChoice data null if queried early
> -----------------------------------------
>
>                 Key: WICKET-1979
>                 URL: https://issues.apache.org/jira/browse/WICKET-1979
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 1.3.5
>         Environment: Windows 2000, Sun JDK 1.6
>            Reporter: bernard
>            Assignee: Igor Vaynberg
>            Priority: Minor
>
> If DropDownChoice is created with Arrays.asList(MyEnum.values()), then getValue() or
> getConvertedInput() returns null if called during conditional validation as proposed in
> http://cwiki.apache.org/WICKET/conditional-validation.html
> The workaround I use is as follows:
> TextField userId = new TextField("userId", new PropertyModel(member, "userId")){
>     @Override
>     public boolean isRequired() {
>         // Return true if the field is required
>         // Call validate() to work around the issue, otherwise getConvertedInput() returns null.
>         dropDownChoiceMyEnum.validate();
>         MyEnum selectedType = (MyEnum) dropDownChoiceMyEnum.getConvertedInput();
>         return(selectedType == MyEnum.MY_TYPE);
>     }
> };
> I don't know whether my workaround is correct. I don't know whether this is general or whether
> it happens with enums only. But I think that either this is a bug or that the manual page for conditional validation needs an update.
> The current situation can be quite frustrating for beginners.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.