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

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

Igor Vaynberg resolved WICKET-1979.
-----------------------------------

    Resolution: Won't Fix
      Assignee: Igor Vaynberg

you are creating inter-formcomponent dependencies for the validation workflow, but we do not guarantee the order in which components are validated. that is why, probably, juergen could not reproduce it himself.

the proper thing to do is to validate this yourself eitherusing formcomponentvalidator or your own logic.

requred and ivalidator are meant to validate components in isolation.

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