Hi all,

I guess I should have mentioned that this problem also exists in the latest
CVS version of Fulcrum...

Has anyone encountered this before?

-- Rodney


On Wed, 20 Mar 2002 17:50, you wrote:

> Hi all,
>
> One of my fellow developers (not subscribed to this list) sent me this bug
> report (or question) regarding Intake...
>
> ---------------------------------------------------------------
>
> If a browser submits a form with an empty text field (with, say, the
> parameter name="foo"), then the request parameters will come in in the form
> "?foo=&bar=..." etc., and both javax.servlet.HttpServletRequest and
> org.apache.turbine.util.ParameterParser will report that the parameter
> "foo" is present with the value "" (the empty string).  However,
> org.apache.turbine.services.intake.model.Field will treat this field as if
> it is not present at all: specifically, in the method validate() is the
> following code:
>
>             stringValue = pp.getString(getKey());
>             if ( stringValue.length() == 0 )
>             {
>                 set_flag = false;
>             }
>
> Thus, there is no way to distinguish between an empty field and an absent
> field.  This is an issue where the field previously had been non-empty (say
> in the corresponding Torque object), and had been explicitly emptied in the
> form by the user.  This causes the following problems:
>
> 1.) org.apache.turbine.services.intake.model.Group.setProperties(Object
> obj) will not set this field to empty in obj; this has to be (awkwardly)
> done by hand in the Action class.
> 2.) If the browser is returned to the form (say, another field was
>     invalid), this field will no longer be empty, unless again it is
> explicitly emptied by the Action or Screen class.
>
> And if the above explicit coding is done, then:
>
> 3.) We will have hard-coded behaviour in the Action redundantly replicating
>     information in the intake group, and
> 4.) This Action cannot be reused by multiple forms: for instance, by
>     another form which did not present this field, because the Action
>     could not tell whether the field was present and set to empty, or not
>     present.
>
> Why has org.apache.turbine.services.intake.model.Field been coded this
> way?  And is there another way of achieving what I'm trying to achieve
> here?
>
> ---------------------------------------------------------------
>
> I could generate a patch that removed the above-mentioned test
> (and also the equivalent test for multi-valued fields), but I am
> not sure if this will create other problems.
>
> Any help would be greatly appreciated.
>
> Thanks in advance,
>
> -- Rodney

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to