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:53:44 UTC

[jira] Updated: (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 updated WICKET-1979:
----------------------------

    Attachment: testcase.zip

test case in zip file

> 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
>         Attachments: testcase.zip
>
>
> 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.