cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bruno Dumon <br...@outerthought.org>
Subject Re: [Woody multi page forms] was Re: cvs commit:cocoon-2.1/src/blocks/woody/java/org/apache/cocoon/woody/flow/javascriptwoody.js
Date Thu, 11 Sep 2003 11:39:08 GMT
On Wed, 2003-09-10 at 09:54, Sylvain Wallez wrote:
> Christopher Oliver wrote:
> 
> > BTW that flowscript code was written with the intention of supporting 
> > multi-page Woody forms with automated back/forward navigation as in 
> > JXForms. However, when I looked into implementing this I discovered 
> > that Woody forms cannot be presented in multiple pages because 
> > apparently the entire form is "submitted" with each request. As a 
> > result the fields that are not presented in the first page fail 
> > validation because they have no values. Or am I missing something? 
> 
> 
> No, you got it right : Woody always validates the whole form.

Yep, though it is possible to make a container widget that only
delegates request processing and validation to a subset of its widgets,
ie something like:

<wd:multipage id="something">
  <wd:page id="1">
    <wd:field .... />
    <wd:field .... />
  </wd:page>
  <wd:page id="2">
    <wd:field .... />
    <wd:field .... />
  </wd:page>
</wd:multipage>

depending on the value of some request parameter, the wd:multipage
widget would only let a certain group of widgets process the request.

Another approach to collecting data over multiple pages would simply be
to create multiple (different) forms, which is of course already
possible today.

What's the best solution probably depends on the use case, I didn't felt
the need yet for the first one.

> 
> > In addition, the "validator" function in show() was not intended to 
> > return a value. I did that originally simply because it wasn't 
> > possible to programatically add validation errors to the form widgets 
> > themselves at the time it was written (not sure if that's still the case).
> 
> 
> It is possible now, as I added access to the real widgets in order to do 
> this.

I thought the more important step was that you added a
setValidationError() method on the field widget. But then that was also
_only_ the field widget. I'm thinking we should generalize this to all
widgets, and probably also make it into addValidationError(), so that
each widget can get multiple validation errors.

>  But problem is that the form is not informed of this "manual" 
> validation, and therefore there must be a way for the validator function 
> to express this.

I think returning a boolean to indicate this is a good solution.

-- 
Bruno Dumon                             http://outerthought.org/
Outerthought - Open Source, Java & XML Competence Support Center
bruno@outerthought.org                          bruno@apache.org


Mime
View raw message