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 ... unless I create my own Form class (which may uncover additional issues).
Thanks Bob, Nick. -----Original Message----- From: Bob Schellink [mailto:[email protected]] Sent: Monday, August 15, 2011 7:33 AM To: [email protected] Subject: Re: Form copyFrom issue with HiddenField using HttpServletRequest parameterMap Hi Nick, HiddenField only works with non array values. When you create a custom hidden field make sure you override getValueObject/setValueObject to cast to an array. regards Bob On Mon, Aug 15, 2011 at 2:32 PM, Gilberto <[email protected]> wrote: > Hi, Nick! > > On Mon, Aug 15, 2011 at 4:38 AM, Nicholas Dierauf > <[email protected]> wrote: >> Hello, >> >> >> >> I am trying to populate form fields from an HttpServletRequest >> parameter map using Form.copyFrom(map). I am finding that all but >> HiddenField(s) are getting populated. For the HiddenField, an >> IllegalArguementException is getting thrown: >> >> >> >> java.lang.IllegalArgumentException: The value.getClass(): >> '[Ljava.lang.String;' must be the same as the HiddenField valueClass: >> 'java.lang.String' >> >> at >> org.apache.click.control.HiddenField.setValueObject(HiddenField.java: >> 243) >> >> at >> org.apache.click.util.ContainerUtils.copyMapToFields(ContainerUtils.j >> ava:1100) >> >> ... >> >> >> >> The HiddenField is different from other fields in that it uses a >> 'valueObject' rather than a value String. I've tried setting the >> valueObject in the HiddenField constructor to match the String array >> that is used in the parameter map, but with no luck. I even tried >> creating my own HiddenField > > > I did not understand your issue! > Are you trying to set one HiddenField[1] with one array? > > Can you elaborate on it? > > Regards, > > Gilberto > > [1] > http://click.apache.org/docs/click-api/org/apache/click/control/HiddenField.html >
