You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Eric Hamacher <er...@enetrix.com> on 2008/07/11 16:59:58 UTC

question about submitting checkboxes

Hello:

 

I have a form on which there can, in theory, be an infinite number of
checkboxes (Users are selecting files from a tree and there is no
telling how many will be selected).  The name of each checkbox is
determined at runtime (= to the path of the file).  That being the case,
how can I set up an action to read these parameters?  Or do it need to
go back to the servlet API?

 

Thanks. 

 

Regards,

Eric Hamacher

 

******************************

THIS EMAIL IS INTENDED ONLY FOR THE REVIEW OF THE ADDRESSEE(S), AND MAY
CONTAIN CONFIDENTIAL AND LEGALLY PRIVILEGED INFORMATION. INTERCEPTION,
COPYING, DISSEMINATION, OR OTHER USE BY OTHER THAN THE ADDRESSEE(S) IS
PROHIBITED AND MAY BE PENALIZED UNDER APPLICABLE PRIVACY LAWS. IF YOU
RECEIVED THIS EMAIL IN ERROR, PLEASE DELETE IT AND NOTIFY ME BY RETURN
EMAIL TO eric.hamacher@enetrix.com *******************************

 


RE: question about submitting checkboxes

Posted by Jishnu Viswanath <ji...@tavant.com>.
Eric,
	If you are using struts 2, Eric have u tried s:checkboxList ??
Syntax: <s:checkboxlist list="" listKey=""  listValue="" name=""/>

If its just a Boolean object ignore the key value :D


Regards,

Jishnu Viswanath

Software Engineer

*(+9180)41190300 - 222(Ext) ll * ( + 91 ) 9731209330ll

Tavant Technologies Inc.,

www.tavant.com

PEOPLE :: PASSION :: EXCELLENCE


-----Original Message-----
From: Jeromy Evans [mailto:jeromy.evans@blueskyminds.com.au] 
Sent: Sunday, July 13, 2008 1:38 PM
To: Struts Users Mailing List
Subject: Re: question about submitting checkboxes

Eric Hamacher wrote:
> Hello:
>
>  
>
> I have a form on which there can, in theory, be an infinite number of
> checkboxes (Users are selecting files from a tree and there is no
> telling how many will be selected).  The name of each checkbox is
> determined at runtime (= to the path of the file).  That being the
case,
> how can I set up an action to read these parameters?  Or do it need to
> go back to the servlet API?
>
>   
If you're using Struts 2, don't name your checkboxes like that.
Create an array or list property in your action and include the index in

each checkbox name:

List<String> filenames = new LinkedList<String>();

<input type="checkbox" name="filenames[0]" value="filenameA">
<input type="checkbox" name="filenames[1]" value="filenameB">
<input type="checkbox" name="filenames[2]" value="filenameC">


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

Any comments or statements made in this email are not necessarily those of Tavant Technologies.
The information transmitted is intended only for the person or entity to which it is addressed and may 
contain confidential and/or privileged material. If you have received this in error, please contact the 
sender and delete the material from any computer. All e-mails sent from or to Tavant Technologies 
may be subject to our monitoring procedures.


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


Re: question about submitting checkboxes

Posted by Jeromy Evans <je...@blueskyminds.com.au>.
Eric Hamacher wrote:
> Hello:
>
>  
>
> I have a form on which there can, in theory, be an infinite number of
> checkboxes (Users are selecting files from a tree and there is no
> telling how many will be selected).  The name of each checkbox is
> determined at runtime (= to the path of the file).  That being the case,
> how can I set up an action to read these parameters?  Or do it need to
> go back to the servlet API?
>
>   
If you're using Struts 2, don't name your checkboxes like that.
Create an array or list property in your action and include the index in 
each checkbox name:

List<String> filenames = new LinkedList<String>();

<input type="checkbox" name="filenames[0]" value="filenameA">
<input type="checkbox" name="filenames[1]" value="filenameB">
<input type="checkbox" name="filenames[2]" value="filenameC">


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