• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Need help in getting check box values

 
pankaj semwal
Ranch Hand
Posts: 303
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I am dynamically adding check boxes by iterating the certain values from the database.
My problem is that when i trying to get the values of check boxes i am not getting when submitting the form.



Please help.

Thanks
 
Aparna Raghavan
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
what is the exact problem you are facing?
Did you do it this way?
1. have different names for the check box (in the iteration you can append the id to the name )
2. retrieve the values in the action class from the request parameter (only checked box names will be there)



 
meehul Chopra
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
pankaj semwal wrote:Hi,

I am dynamically adding check boxes by iterating the certain values from the database.
My problem is that when i trying to get the values of check boxes i am not getting when submitting the form.



Please help.

Thanks


Hey Pankaj,

Have you tried request.getParameterValues("candidate_id1");
The above function returns an array which gives mulitple checkbox options seleted...
 
pankaj semwal
Ranch Hand
Posts: 303
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes i have different check box values name as i am getting check box dyanmically.
My prblem is that i want to get the vales of chekc box in Action class.

Thanks
 
Aparna Raghavan
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
pankaj semwal wrote:Yes i have different check box values name as i am getting check box dyanmically.
My prblem is that i want to get the vales of chekc box in Action class.

Thanks



request.getParameter("name") should give you the value.... how did you try to get the value... As a first step, you can run your application on debug mode and check whether you are getting the values in the request parameter map.
i have not explored much about getting the values using request.getParameterValues("candidate_id1");
you can try that too....
 
meehul Chopra
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
pankaj semwal wrote:Yes i have different check box values name as i am getting check box dyanmically.
My prblem is that i want to get the vales of chekc box in Action class.

Thanks


Hi Pankaj,
Do all of your dynamically generated checkboxes have the same name and different values....if yes then at the server side code
you can very well use request.getParameterValues(//Name of the checkbox group//)
 
pankaj semwal
Ranch Hand
Posts: 303
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

How can i get the values like request.getParameterValues("candidate_id1"); as need values in

Action class method. i.e in save method

this my jsp page and action class

my jsp page


myaction class
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic