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

Igor Vaynberg resolved WICKET-1797.
-----------------------------------

       Resolution: Fixed
    Fix Version/s: 1.4-M4
                   1.3.5
         Assignee: Igor Vaynberg

> Bug with default RadioChoice "for" attribute on label generation.
> -----------------------------------------------------------------
>
>                 Key: WICKET-1797
>                 URL: https://issues.apache.org/jira/browse/WICKET-1797
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 1.4-M1
>            Reporter: Ned Collyer
>            Assignee: Igor Vaynberg
>            Priority: Minor
>             Fix For: 1.3.5, 1.4-M4
>
>
> If you use 2 forms of the same name, with radio choice with the same name and 
> values, then the "for" attribute is generated based on the name relative to 
> the current form, and the index of the option.
> This generated incorrect html.
> The behaviour is: when you click on the label of radio items in the second 
> form, the items in the first form are selected.
> For example
> class userdetailspanel extends panel {
>   userdetailspanel(string id) {
>     super(id)
>     Form form = new Form("testForm");
>     List SITES = Arrays.asList(new String[] { "The Server Side", "Java Lobby" 
> });
>     form.add(new RadioChoice("site", SITES));
>   }
> }
> class detailspage extends page {
>   detailspage() {
>     add(new userdetailspanel("panel1"));
>     add(new userdetailspanel("panel2"));
>   }
> }
> This is because of the way the IDs are generated in RadioChoice.  
> Specifically around
>   String id = getChoiceRenderer().getIdValue(choice, index);
>   final String idAttr = getInputName() + "_" + id;
> A workaround I have has been adding a choice renderer when creating any of 
> these RadioChoices.  I have been overriding getIdValue to return something 
> unique. (based off the housing components markupid)

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

Reply via email to