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 2010/08/27 05:43:54 UTC

[jira] Resolved: (WICKET-2905) Select.isSelected fails when Wicket application is using REDIRECT_TO_RENDER render strategy.

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

Igor Vaynberg resolved WICKET-2905.
-----------------------------------

         Assignee: Igor Vaynberg
    Fix Version/s: 1.4.11
                   1.5-M2
       Resolution: Fixed

> Select.isSelected fails when Wicket application is using REDIRECT_TO_RENDER render strategy.
> --------------------------------------------------------------------------------------------
>
>                 Key: WICKET-2905
>                 URL: https://issues.apache.org/jira/browse/WICKET-2905
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket-extensions
>    Affects Versions: 1.4.9
>            Reporter: Liam Clarke-Hutchinson
>            Assignee: Igor Vaynberg
>            Priority: Minor
>             Fix For: 1.4.11, 1.5-M2
>
>         Attachments: select-bug_reproduction.zip, Select.patch
>
>
> To reproduce using attached quick start:
> 1. Leave text field empty
> 2. Select a value in dropdown
> 3. Click submit link
> 4. The text field's validation will fail and the page will refresh with a validation error message
> 5. The dropdown's selected value will always be the first in the option list, no matter what value was selected in step 2.
> As the dropdown is updating its model via the AJAX behaviour, the value selected in step 2 should be the one selected when the page is redisplayed.
> We can workaround this like so: 
>         final Select select = new Select("select", New Model<String>("")) {
>             @Override
>             protected void convertInput() {
>                 super.convertInput();
>                 clearInput();
>             }
>         };
> As this removes the rawInput from Select, Select.isSelected then evaluates the models to determine the selected option. I have attached a patch in universal diff format that fixes this behaviour, and have tested it under all render strategies. I haven't written a unit test for this as the bug ultimately relied on submitted values not being available in a request, and I wasn't able to determine how to emulate this in a unit testing environment. (Pointers more than welcome. :) )

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