You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Andrew Steady <An...@kinesis.com> on 2001/04/19 12:47:06 UTC

null or empty string

Hi,



I have written a dynamic validation routine which is based upon only
      validating the fields that have been submitted and then "mopping up"
      later. This only works because you can tell the difference

between a field being submitted and left blank (value = "") and a field not
      being present in the request (value = null).



This is true for input type="text" but is not true for input
      type="checkbox", has anyone come accross this problem before? any
      solutions ideas?



Cheers,



Andy S



Re: null or empty string

Posted by Paul Tindall <pt...@houston.rr.com>.
Andrew,

CheckBox values are retrieved using the getParameterValues method on the the
HTTPServletRequest object which returns a string array.  Most other input
types simply use the getParameter method which work as you describe below.

Regards,

Paul


----- Original Message -----
From: "Andrew Steady" <An...@kinesis.com>
To: <st...@jakarta.apache.org>
Sent: Thursday, April 19, 2001 5:47 AM
Subject: null or empty string


>
> Hi,
>
>
>
> I have written a dynamic validation routine which is based upon only
>       validating the fields that have been submitted and then "mopping up"
>       later. This only works because you can tell the difference
>
> between a field being submitted and left blank (value = "") and a field
not
>       being present in the request (value = null).
>
>
>
> This is true for input type="text" but is not true for input
>       type="checkbox", has anyone come accross this problem before? any
>       solutions ideas?
>
>
>
> Cheers,
>
>
>
> Andy S
>
>
>