Quantcast
Channel: Adobe Community : Popular Discussions - CQ5 (read only)
Viewing all articles
Browse latest Browse all 12476

request.getParameter() not working correctly for Check Boxes!

$
0
0

Hi,

I am writing my own custom form action in cq5.4 and I need to access the fields of my form. I have a checkbox component on my form named 'cbox' and now I want to access it.

 

So this is the code I'm writing in the JSP

String name = request.getParameter("cbox");

 

But when I fill up the data on the form and submit it.. I only get the first element of the checkbox which I had selected. So suppose if the checkbox was having some options..

a

b

c

d

and if I selected b and d then I only get 'b'.

 

Actually the type of the name variable must be String Array. But when I do..

String[] name = request.getParameter("cbox");

//it gives me compilation error saying cannot convert from String to String[]

 

I cannot understand whats happening here. Can someone help me? How do I find out that which options has the user checked?

 

Thanks!


Viewing all articles
Browse latest Browse all 12476

Trending Articles