cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sylvain Wallez <sylvain.wal...@anyware-tech.com>
Subject Re: [Woody] woody.js (show) woody2.js (showForm) et al
Date Fri, 17 Oct 2003 09:30:52 GMT
Barzilai Spinak wrote:

> Sylvain, or whoever can clarify this:
>
> Recenlty there was an addition of woody2.js for flowscript handlinf of 
> Woody.
> It looks like woody2.js  is a "new version" of woody.js  (deprecating 
> the latter). Or is it just an "addition"?


Exactly. This a new version which is a cleanup of the previous one and 
provides a form.showForm() method similar to cocoon.sendPageAndWait(), 
i.e. with the possibility to send data to the view.

> Forms used to have a show method. Now in woody2.js they have a 
> showForm method. But the old show
> allowed a "validator function" parameter and the new showForm just 
> accepts a bizData.
> As a side note, the comment block for showForm says:
>
> * This uses some additionnal propertied on the form object :
> * - "locale" : the form locale (default locale is used if not set)
> * - "validator" : additional validation function. This function receives
> *   the form object as parameter and should return a boolean indicating
> *   if the form handling is finished (true) or if the form should be
> *   redisplayed again (false)
>
> but it's not clear to me how to assign a validator to the form from 
> flowscript. 


The locale and validator are now a property of the form.

form.validator = function(form) {
  if (some additional test) {
    return true; // valid
  } else {
    return false; // invalid
  }
}

But... this is still work in progress, and adding the event handling 
stuff made me consider that this additional flowscript-level validator 
was kind of hacky solution to what could be done in the form itself.

As for the locale, I consider that the current locale management in 
Cocoon is messy: we need to pass the locale around everywhere and each 
component defines its own way to get it. We should use 
environment-adapters so that we can simply use request.getLocale(). But 
that's another story (I'm preparing a RT on environment adapters).

> The binding bean sample:
> in Cocoon 2.1 uses  <wd:button> for row adding/deleting
> Cocoon 2.1.1 and 2.1.2 use <wd:action> but it seems like it's already 
> deprecated and
> it mentions we should use  <wd:repeater-action> instead. 


<wd:action> is still there, and <wd:repeater-action> are specialized 
actions with built-in action handlers that modify a repeater.

> This is all good and great but there's zero documentation on how to do 
> it! 


Yep. I know this is not the answer you will like to here but although 
functionnal, Woody is an unstable block, and using it means living on 
the bleeding edge.

> Woody looks very powerful and with a great future but at the same time 
> it looks like a big pile
> of XML tags that you can put together nested within each other in 
> undocumented ways, while new ones
> keep appearing and others are deprecated.
>
> Maybe I'm part of my own problem because I hate coding by copying and 
> pasting undocumented examples
> and changing things here and there until "It Works"(tm)  but not being 
> quite sure why or how. I prefer having
> a whole vision and understanding of concepts and tools/syntax, etc. 
> and how to put them together.
> Right now, the best Woody documentation there is, is the one at the 
> Wiki pages which is several eons old
> and just shows a lot of disperesed concepts and bits but not the wires 
> that make them work with each other.


Well, don't forget that this is a collective work based on voluntary 
contributions. If you have good writing abilities, don't hesitate to 
contribute some docs.

I know that what I added to woody is not documented but I just _added_ 
to what existed and the corresponding docs written by Bruno are still 
valid, although incomplete. BTW, I consider that Bruno did an very good 
job by writing the current docs.

> I don't want to sound like I'm complaining, because I'm very thankful 
> to the Cocoon developers for such a fine
> project and community. I'd even like to contribute to Woody but right 
> now it's like trying to grab a giant,
> wobbling piece of gelatin.


You're not totally wrong. That's the price to pay for using features 
added very recently.

Sylvain

-- 
Sylvain Wallez                                  Anyware Technologies
http://www.apache.org/~sylvain           http://www.anyware-tech.com
{ XML, Java, Cocoon, OpenSource }*{ Training, Consulting, Projects }
Orixo, the opensource XML business alliance  -  http://www.orixo.com



Mime
View raw message