Yeah. That's exactly what I have done. It is working fine now. Thanks for your time, Bob. Nick.
-----Original Message----- From: Bob Schellink [mailto:[email protected]] Sent: Monday, August 15, 2011 10:04 PM To: [email protected] Subject: Re: Form copyFrom issue with HiddenField using HttpServletRequest parameterMap Ah I understand, however copying an array to a hidden or any other field won't work unless the field is customized to handle arrays. What should work is to masage the request map into a new map that uses a String instead of array if there request map only has one entry. If it has multiple entries then leave it as an array. Should be easy to write a function that does this, eg: Map mymap = MyUtil.convertToSingleValueMap(request); regards Bob On 2011/08/15 19:43 PM, Nicholas Dierauf wrote: > It does work fine with my custom HiddenField. It doesn't work with the Click > HiddenField. The map returned from the Request.getParameterMap() method is a > Map<String, String[]> rather than a Map<String, String>. So the Click > HiddenField.setValueObject(object) gets confused because it receives a > String[] even when I have configured it to expect a valueClass of String[] > (or String). > > If you were to create a simple Click Form named "myForm", then submit the > form and attempt to populate a new Form object (server-side) using > newForm.copyFrom(request.getParameterMap()), I believe that you will find > that an IllegalArguementException is thrown when the Click > HiddenField.setValueObject(stringArray) is called for this hidden field: > <input id="myForm_form_name" type="hidden" value="myForm" > name="form_name"> > > (This hidden field is populated automatically by Form.toString(), and > is a Click HiddenField object.) > > Thank you, > Nick. > > -----Original Message----- > From: Bob Schellink [mailto:[email protected]] > Sent: Monday, August 15, 2011 10:11 AM > To: [email protected] > Subject: Re: Form copyFrom issue with HiddenField using > HttpServletRequest parameterMap > > On 2011/08/15 18:49 PM, Nicholas Dierauf wrote: >> Hi Bob. I did override the get/setValueObject methods in my custom >> HiddenField class, which seemed to work for my own HiddenField members. But >> the Form class generates additional Click HiddenField members to pass a >> couple of extra parameters, including the form name. I don't have any >> control over which version of HiddenField that Click Form uses ... > > The copyForm iterates all fields and calls set/getValueObject on each one. I > would expect that the HiddenFields Click added should still work fine even > when mixed with your custom HiddenFields. > > regards > > Bob >
