You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Jeffrey Porter <PO...@WMGMAIL.wmg.warwick.ac.uk> on 2005/10/17 10:36:00 UTC

selectOneRadio - How to validate?

 

I have a radio button on my page created by a selectOneRadio tag. But I
can submit the page without selecting an option.

How to I get the radio button group to be validated? 

 

I can see there is the tag "validator", does this mean I have to
implement a class to check that one option has been selected.

Or is there a default class I can use?

 

Thanks

Jeff

 

 

<h:outputLabel for="discoveryLocation"
value="#{ebusiness_properties['NCM_label_discoveryLocation']}" />

 

<h:selectOneRadio 

disabledClass="bodyheading" 

enabledClass="bodyheading" 

id="discoveryLocation" 

value="#{nonConformingMaterial.discoveryLocation}" 

layout="lineDirection"  

styleClass="selectOneRadio">

<f:selectItem itemValue="0"
itemLabel="#{my_properties['NCM_label_location_0']}" />

      <f:selectItem itemValue="1"
itemLabel="#{my_properties['NCM_label_location_1']}"  />

                

</h:selectOneRadio>


Re: selectOneRadio - How to validate?

Posted by Volker Weber <us...@weber-oldenburg.de>.
Hi,

use selectOneRadios attribute required="true".



Jeffrey Porter wrote:
>  
> 
> I have a radio button on my page created by a selectOneRadio tag. But I
> can submit the page without selecting an option.
> 
> How to I get the radio button group to be validated?
> 
>  
> 
> I can see there is the tag “validator”, does this mean I have to
> implement a class to check that one option has been selected.
> 
> Or is there a default class I can use?
> 
>  
> 
> Thanks
> 
> Jeff
> 
>  
> 
>  
> 
> <h:outputLabel for="discoveryLocation"
> value="#{ebusiness_properties['NCM_label_discoveryLocation']}" />
> 
>  
> 
> <h:selectOneRadio
> 
> disabledClass="bodyheading"
> 
> enabledClass="bodyheading"
> 
> id="discoveryLocation"
> 
> value="#{nonConformingMaterial.discoveryLocation}"
> 
> layout="lineDirection" 
> 
> styleClass="selectOneRadio">
> 
> <f:selectItem itemValue="0"
> itemLabel="#{my_properties['NCM_label_location_0']}" />
> 
>       <f:selectItem itemValue="1"
> itemLabel="#{my_properties['NCM_label_location_1']}"  />
> 
>                
> 
> </h:selectOneRadio>
> 

-- 
Don't answer to From: address!
Mail to this account are droped if not recieved via mailinglist.
To contact me direct create the mail address by
concatenating my forename to my senders domain.