Re: Need help fixing a Woody flow sample

2003-08-21 Thread Marc Portier


Timothy Larson wrote:
In woody.js [1] there was a change in version 1.6 that stopped calling:
  cocoon.request.setAttribute(this.attrName, this.form);
and did this instead:
  var bizData = { woody-form: this.form };
indeed, this lines up more with how flow is expected to be working

This will require a change in this part of form1_success.xsp [2]:
  // get reference to form and some of the widgets on it
  Form form = (Form)request.getAttribute(form1);
of course we need to consider that this xsp is also used in the 
context of the non-flowscript (but Actions) pipelines that ARE 
putting it just there.

from that viewpoint I think it makes sense to let the flow-script 
bend a bit towards this forehoped reuse.

in any case checking up on the woody_flow_example.js I see that 
it is not even adding any bizData in the sendPage call!
(so there really is no way at all for the xsp to look for the 
form in any part of the context in this way)

so shortest hack to me looks like adding
cocoon.request.setAttribute(form1, form);
in front of:
cocoon.sendPage(form1-success-pipeline);
in terms of best practice I would probably be advocating the use 
of jxtemplate in combinaion with flow rather then xsp

(which would avoid your question about jpath logicsheet as well)

  Field field = (Field)form.getWidget(email);
IIUC the change would involve using the jpath logicsheet, but I have
not been able to figure out how to get the Form object.
Anybody know how to do this?
[1] cocoon-2.1/src/blocks/woody/java/org/apache/cocoon/woody/flow/javascript/woody.js
[2] cocoon-2.1/src/blocks/woody/samples/forms/form1_success.xsp
--Tim Larson



(will test and commit above thoughts later)

regards,
-marc=
--
Marc Portierhttp://outerthought.org/
Outerthought - Open Source, Java  XML Competence Support Center
Read my weblog at  http://radio.weblogs.com/0116284/
[EMAIL PROTECTED]  [EMAIL PROTECTED]


Re: Need help fixing a Woody flow sample

2003-08-21 Thread Steven Noels
Marc Portier wrote:

in terms of best practice I would probably be advocating the use of 
jxtemplate in combinaion with flow rather then xsp
+1

JXTemplate is massive but works nice and dandy.

/Steven
--
Steven Noelshttp://outerthought.org/
Outerthought - Open Source, Java  XML Competence Support Center
Read my weblog athttp://blogs.cocoondev.org/stevenn/
stevenn at outerthought.orgstevenn at apache.org


Re: Need help fixing a Woody flow sample

2003-08-21 Thread Christopher Oliver
IMO the change to use woody-form is very poor choice because its not a 
valid Jexl identifier. This means that if you want to access it in 
JXTemplate you have to use this syntax:

${flowContext['woody-form'].someWidget}

If you change it to say 'woodyForm' you can access it directly:

${woodyForm.someWidget}

As far as Xsp, you should be able to access it using jpath:

jpath:value-of select=woody-form/someWidget/

My $0.02,

Chris

Timothy Larson wrote:

Comments inline...

--- Marc Portier [EMAIL PROTECTED] wrote:
 

Timothy Larson wrote:
   

In woody.js [1] there was a change in version 1.6 that stopped calling:
 cocoon.request.setAttribute(this.attrName, this.form);
and did this instead:
 var bizData = { woody-form: this.form };
 

...
 

so shortest hack to me looks like adding
cocoon.request.setAttribute(form1, form);
in front of:
cocoon.sendPage(form1-success-pipeline);
   

I tried form, this.form, and form.form, but only form.form
worked without changing the XSP:
 cocoon.request.setAttribute(form1, form.form);
If you use this in the flowscript:
 cocoon.request.setAttribute(form1, form);
then in XSP how do you get from request.getAttribute(form1)
to a Form object?  I am not too sure how this java-javascript
interfacing works yet.
 

in terms of best practice I would probably be advocating the use 
of jxtemplate in combinaion with flow rather then xsp

(which would avoid your question about jpath logicsheet as well)
   

I would still like to know the jpath answer, and also how to use
plain java to access a form held by the flow.  Do you know how/have
time to explain it?
--Tim Larson

__
Do you Yahoo!?
The New Yahoo! Search - Faster. Easier. Bingo.
http://search.yahoo.com
 





Re: Need help fixing a Woody flow sample

2003-08-21 Thread Timothy Larson
Thanks for the help.
So far, this is the only way I have gotten this to work.
In the flow change:
  cocoon.sendPage(success-pipeline);
to:
  cocoon.sendPage(success-pipeline, {woody:form.getModel()});
and in a JXTemplate file use this syntax to get the value of the
name widget:
  h3Name: ${woody.name}/h3

--Tim Larson

--- Christopher Oliver [EMAIL PROTECTED] wrote:
 IMO the change to use woody-form is very poor choice because its not a 
 valid Jexl identifier. This means that if you want to access it in 
 JXTemplate you have to use this syntax:
 
 ${flowContext['woody-form'].someWidget}
 
 If you change it to say 'woodyForm' you can access it directly:
 
 ${woodyForm.someWidget}
 
 As far as Xsp, you should be able to access it using jpath:
 
 jpath:value-of select=woody-form/someWidget/
 
 
 My $0.02,
 
 Chris



__
Do you Yahoo!?
The New Yahoo! Search - Faster. Easier. Bingo.
http://search.yahoo.com


RE: Need help fixing a Woody flow sample

2003-08-21 Thread Christopher Oliver
Oh, you're talking about cocoon.sendPage(). Well, yeah you have to pass
the object then. The way you did it is correct. Of course, you could
have simply passed the form widget itself:

cocoon.sendPage(success-pipeline, form.getModel());

h3${name}/h3

Most of this _is_ documented:
http://cocoon.apache.org/2.1/userdocs/flow/index.html

Chris

-Original Message-
From: Timothy Larson [mailto:[EMAIL PROTECTED] 
Sent: Thursday, August 21, 2003 12:54 PM
To: [EMAIL PROTECTED]
Subject: Re: Need help fixing a Woody flow sample

Thanks for the help.
So far, this is the only way I have gotten this to work.
In the flow change:
  cocoon.sendPage(success-pipeline);
to:
  cocoon.sendPage(success-pipeline, {woody:form.getModel()});
and in a JXTemplate file use this syntax to get the value of the
name widget:
  h3Name: ${woody.name}/h3

--Tim Larson

--- Christopher Oliver [EMAIL PROTECTED] wrote:
 IMO the change to use woody-form is very poor choice because its not
a 
 valid Jexl identifier. This means that if you want to access it in 
 JXTemplate you have to use this syntax:
 
 ${flowContext['woody-form'].someWidget}
 
 If you change it to say 'woodyForm' you can access it directly:
 
 ${woodyForm.someWidget}
 
 As far as Xsp, you should be able to access it using jpath:
 
 jpath:value-of select=woody-form/someWidget/
 
 
 My $0.02,
 
 Chris



__
Do you Yahoo!?
The New Yahoo! Search - Faster. Easier. Bingo.
http://search.yahoo.com