You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Ben Wong <be...@matthiasgroup.com> on 2005/09/02 23:22:19 UTC

Creating checkboxes with the same name

Hi everyone,

 

I am now trying do build a form with a list of checkboxes where you can
select one or more.  Very basic.  However, I want to make sure that at least
one item is checked (selected) before the form is submitted.  This is doable
in Javascript if all the checkboxes have the same HTML name.  It looks like
Tapestry creates the checkboxes with different names (e.g. selectedScan,
selectedScan$0, selectedScan$1.).  For example, the HTML generated is:

 

<tr>

   <td align="center"><input type="checkbox" name="selectedScan"/></td>

   <td>lrtest02</td>

   <td>DEVELOPER</td>

</tr>

<tr> 

   <td align="center"><input type="checkbox" name="selectedScan$0"/></td>

   <td>lrtest03</td>

   <td>DEVELOPER</td>

</tr>

 

Does anyone have any thoughts on this issue or how they have implemented
this?  Having the checkboxes with the same name allows one to add a lot more
client functionality (e.g. ability to let the user select/deselect the
entire list).

 

Thanks,

Ben Wong 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 


Re: Creating checkboxes with the same name

Posted by Jun Tsai <ju...@gmail.com>.
On 9/3/05, Ben Wong <be...@matthiasgroup.com> wrote:
> 
> Hi everyone,
> 
> 
> 
> I am now trying do build a form with a list of checkboxes where you can
> select one or more. Very basic. However, I want to make sure that at least
> one item is checked (selected) before the form is submitted. This is 
> doable
> in Javascript if all the checkboxes have the same HTML name. It looks like
> Tapestry creates the checkboxes with different names (e.g. selectedScan,
> selectedScan$0, selectedScan$1.). For example, the HTML generated is:
> 
> 
> 
> <tr>
> 
> <td align="center"><input type="checkbox" name="selectedScan"/></td>
> 
> <td>lrtest02</td>
> 
> <td>DEVELOPER</td>
> 
> </tr>
> 
> <tr>
> 
> <td align="center"><input type="checkbox" name="selectedScan$0"/></td>
> 
> <td>lrtest03</td>
> 
> <td>DEVELOPER</td>
> 
> </tr>
> 
> 
> 
> Does anyone have any thoughts on this issue or how they have implemented
> this? Having the checkboxes with the same name allows one to add a lot 
> more
> client functionality (e.g. ability to let the user select/deselect the
> entire list).
> 
> 
> 
> Thanks,
> 
> Ben Wong



You can use tapestry varlidation framework.


-- 
Welcome to China Java Users Group(CNJUG).
http://cnjug.dev.java.net