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

Reply via email to