You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by Chris Newland <ch...@emorphia.com> on 2001/09/06 19:40:22 UTC

formvalidator problem

Hi All,

My understanding of the form validator is:

for each constraint in the constraint set
{

	if (request parameter not null)
	{
		validate constraints
	}
	else
	{
		if (not nullable)
		{
			if (default exists)
			{
				substitute default for null value
			}
			else
			{
				error
			}
		}
		else
		{
			null
		}
	}

}

However because there is no setParameter() method on the Request object, it
is impossible for the default value to be substituted. Therefore currently
the default value mechanism does not work in FormValidatorAction.

One possibility is to set the new value into an attribute, but this requires
that any action that expects a value from a parameter must now check the
attributes. This involves changing existing actions (possibly lots of them).
I've produced a patch for AbstractDatabaseAction which allows attributes to
override parameters but I'm hanging on to it until I can get the best
overall solution clear in my head.

Can somebody please explain to me why there is no setParameter() method on
the Request object? I'm sure there's a very good design reason, but for me
it seems a very quick and easy solution to allowing a chain of actions
working on the same request to update the request parameters as they flow
through the actions.

The alternative seems to be to have *every* action read from both attributes
and parameters and set new values into attributes. If this is the solution
then perhaps we can produce a single helper object where this work can be
done.

I understand that you are all very busy with the next build but I think this
is quite a serious problem when requests flow through a chain of actions.

Thanks and Best Regards,

Chris

--
Chris Newland
Software Research Engineer

Emorphia Ltd
Registered in England.  4133002
Mill House, Station Approach, Harlow Mill, Harlow, Essex, CM20 2EL, UK

Email: chris.newland@emorphia.com
Tel: +44 (0)1279 450100
Fax: +44 (0)1279 450102

Check out FIPA-OS at http://fipa-os.sourceforge.net/

This message may contain information proprietary to Emorphia so any
unauthorised disclosure, copying or distribution of its contents is strictly
prohibited.



---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
For additional commands, email: cocoon-dev-help@xml.apache.org