You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Rob Dennett <ro...@tmit1.org> on 2005/09/21 21:51:23 UTC

unchecked radio button

How do you arrange it so that a radio group will have no buttons checked when the page is first rendered?

 

I have some code in a template

 

<span jwcid="radioGroup">

      <span jwcid="possibleAnswerLoop">

            <input jwcid="radio" /> <span jwcid="answerText" /><br />

      </span>

</span>

 

That renders to this

 

        <input type="radio" name="radioGroup" checked="checked" value="0"/> 000<br />
                               
        <input type="radio" name="radioGroup" checked="checked" value="1"/> 111<br />
                               
        <input type="radio" name="radioGroup" checked="checked" value="2"/> 222<br />
 

The problem here is the checked property is set, which means that the last radio button is selected.  What is the idea here and what should you do here?

 

Thanks for your help,

Rob Dennett


-- 
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.344 / Virus Database: 267.11.1/104 - Release Date: 9/16/2005
 

RE: unchecked radio button

Posted by Patrick Casey <pa...@adelphia.net>.
	How about you enclose them in a radio group and use the selected
property on the radiogroup to choose which one (if any) will be selected on
render?

<span jwcid="@RadioGroup" selected='ognl:pair.response.selected'>
                <span jwcid="@Foreach" source="ognl:pair.question.options"
value="ognl:item" >
    		    	<input type="radio" jwcid="@Radio"
value='ognl:item.value'/>
                    <span jwcid="@Insert" value="ognl:item.text" />

                </span>
                <span jwcid="@Conditional"
condition="ognl:pair.question.type == @survey.Question@CHOICE_OTHER">
    		    	<input type="radio" jwcid="@Radio"
value='ognl:@survey.Question@OTHER_KEY'/>
                    Other
                    <span jwcid="@TextField"
value="ognl:pair.response.other" size="20" />
                </span>
		   	</span>

> -----Original Message-----
> From: Rob Dennett [mailto:rob_dennett@tmit1.org]
> Sent: Wednesday, September 21, 2005 12:51 PM
> To: Tapestry users
> Subject: unchecked radio button
> 
> How do you arrange it so that a radio group will have no buttons checked
> when the page is first rendered?
> 
> 
> 
> I have some code in a template
> 
> 
> 
> <span jwcid="radioGroup">
> 
>       <span jwcid="possibleAnswerLoop">
> 
>             <input jwcid="radio" /> <span jwcid="answerText" /><br />
> 
>       </span>
> 
> </span>
> 
> 
> 
> That renders to this
> 
> 
> 
>         <input type="radio" name="radioGroup" checked="checked"
> value="0"/> 000<br />
> 
>         <input type="radio" name="radioGroup" checked="checked"
> value="1"/> 111<br />
> 
>         <input type="radio" name="radioGroup" checked="checked"
> value="2"/> 222<br />
> 
> 
> The problem here is the checked property is set, which means that the last
> radio button is selected.  What is the idea here and what should you do
> here?
> 
> 
> 
> Thanks for your help,
> 
> Rob Dennett
> 
> 
> --
> No virus found in this outgoing message.
> Checked by AVG Anti-Virus.
> Version: 7.0.344 / Virus Database: 267.11.1/104 - Release Date: 9/16/2005
> 



---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org