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/14 04:16:44 UTC

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

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


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

Posted by "bernard (JIRA)" <ji...@apache.org>.
     [ 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.


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

Posted by "bernard (JIRA)" <ji...@apache.org>.
     [ 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.


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

Posted by "Igor Vaynberg (JIRA)" <ji...@apache.org>.
     [ 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

once again, we do not guarantee the order in which form components are validated. do you understand how that is a problem? because you are creating a dependency from one component to another there must be a way to guarantee that the dependee is validated after - which there is none right now. this is why we have IFormValidator - just for such usecases. you can also use FormComponentPanel to group these dependent components together into one virtual form component.

you can keep pointing to the wiki all you want, but keep in mind its a wiki. anyone can write there and so some pages are bound to be inaccurate or contain wrong information.

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


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

Posted by "Juergen Donnerstag (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WICKET-1979?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12656392#action_12656392 ] 

Juergen Donnerstag commented on WICKET-1979:
--------------------------------------------

I'm not able to reproduce it (1.4 trunk; you reported against 1.3.5). Please see DropDownChoiceTest and test_1979. May be you could update the test case in case it does not properly reflect your problem.

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


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

Posted by "Igor Vaynberg (JIRA)" <ji...@apache.org>.
     [ 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.