Daniel
Brian Rosenthal wrote:
I'm trying to process a multivalued input that's presented as series of checkboxes in my Struts JSP. Users need the ability to make more than one choice. This is the first time I've had to use checkboxes with Keel and I discovered something curious.
Typically, I give a group of checkboxes the same input name and provide a different value for each one. Using standard HTTP and plain ol' Servlets, I can easily call ServletRequest.getParameterValues(String name) to get a String array of *all* the values. Then I can create a simple "for" loop that iterates through each element in the array, pulling out the desired values.
Using Keel of course, request.getParameter("MY_RID") will return a single value. No matter how many boxes are checked, only one will be returned.
I looked at the Poll application to see how Mike handles this. The comments in vote.jsp say that, "A multibox is a bit trickier than the other entry types, because it implies that there are multiple choices available for a single question." SubmitVote seems to do the following:
Prompt Model:This seems like a lot of extra work. Is there something I'm missing?
* Create and add the multivalued input to the response
Struts JSP:
* Use <struts:iterate> tag in the JSP to get each valid value
* Create a new, separate input for each and every choice by appending a unique string to the end of the input's name and assign it a value
Process Model:
* Get the value of each input with
oneKey.startsWith("CHOICE_"))
and then finally putting them all back together.
Thanks,
-BR
-- Brian Rosenthal [EMAIL PROTECTED] PlatinumSolutions, Inc. http://www.platinumsolutions.com 1610 Washington Plaza North Reston VA 20190 PH: 703.471.9793 FAX: 703.471.7140
--
![]()
Daniel Silva
PlatinumSolutions, Inc.
[EMAIL PROTECTED]
http://www.platinumsolutions.com
1610 Washington Plaza North
Reston VA 20190
PH: 703.471.9793 x-207 FAX: 703.471.7140
Daniel Silva
PlatinumSolutions, Inc.
[EMAIL PROTECTED]
http://www.platinumsolutions.com
1610 Washington Plaza North
Reston VA 20190
PH: 703.471.9793 x-207 FAX: 703.471.7140
<<inline: platsol.gif>>
