You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Wolfgang <wk...@ebi.ac.uk> on 2007/10/11 15:42:30 UTC

Set default value for h:selectManyCheckbox

Hi,

how can I set the default behaviour for each checkbox to "clicked"?

  <h:selectManyCheckbox value="#{homePage.selectedServices}" 
layout="pageDirection">
       <f:selectItem itemLabel="A"    itemValue="a"/>
       <f:selectItem itemLabel="B"    itemValue="b"/>
       <f:selectItem itemLabel="C"    itemValue="c"/>
       <f:selectItem itemLabel="D"    itemValue="d"/>
   </h:selectManyCheckbox>

I managed it with the h:selectOneRadio group:

<h:selectOneRadio id="radio" value="#{dataset.type}">
           <f:selectItem itemLabel="Accessions" itemValue="0"/>
           <f:selectItem itemLabel="Sequences" itemValue="1"/>
       </h:selectOneRadio>

   <managed-property>
           <property-name>type</property-name>
           <value>0</value>
       </managed-property>
  But there the property-name is a String and in the above example I 
have a list.
So I don't know how to set all these checkboxes clicked as default 
behaviour.

Cheers,
Wolfgang



Re: Set default value for h:selectManyCheckbox

Posted by Sushma Sharma <su...@yahoo.co.in>.
as far as I know, h:selectMany components take String
arrays as their values.
so, your "#{homePage.selectedServices}" should return
an array of selected values.


--- Wolfgang <wk...@ebi.ac.uk> wrote:

> Hi,
> 
> how can I set the default behaviour for each
> checkbox to "clicked"?
> 
>   <h:selectManyCheckbox
> value="#{homePage.selectedServices}" 
> layout="pageDirection">
>        <f:selectItem itemLabel="A"   
> itemValue="a"/>
>        <f:selectItem itemLabel="B"   
> itemValue="b"/>
>        <f:selectItem itemLabel="C"   
> itemValue="c"/>
>        <f:selectItem itemLabel="D"   
> itemValue="d"/>
>    </h:selectManyCheckbox>
> 
> I managed it with the h:selectOneRadio group:
> 
> <h:selectOneRadio id="radio"
> value="#{dataset.type}">
>            <f:selectItem itemLabel="Accessions"
> itemValue="0"/>
>            <f:selectItem itemLabel="Sequences"
> itemValue="1"/>
>        </h:selectOneRadio>
> 
>    <managed-property>
>            <property-name>type</property-name>
>            <value>0</value>
>        </managed-property>
>   But there the property-name is a String and in the
> above example I 
> have a list.
> So I don't know how to set all these checkboxes
> clicked as default 
> behaviour.
> 
> Cheers,
> Wolfgang
> 
> 
> 


    The word "Impossible" itself says " I m possible".
  Sushma





      ____________________________________________________________________________________
Shape Yahoo! in your own image.  Join our Network Research Panel today!   http://surveylink.yahoo.com/gmrs/yahoo_panel_invite.asp?a=7