Re: Need some help w/ Woody Template

2004-02-11 Thread Bruno Dumon
On Tue, 2004-02-10 at 11:37, Mark Lundquist wrote:
 Hi all,
 
 I need to put a couple of forms on a page. 
 TheWoodyTemplateTransformer wiki page says the way to do this is to
 usethe special @location attribute on wt:form-template, to tell
 thetransformer where to pick up the form instance.
 
 It's kinda sketchy, but I think I can dig what they're getting
 atthere.  So I did this:
 
 wd:form-template
 location=getAttribute($request, 'form1')
   action=#{$continuation/id}.continue method=POST
 
 
 ...and then I went like this in my flow:
 
 form1 = new Form (form1.wd);
 cocoon.request.setAttribute (form1, form1.form);
 
 form2 = new Form (form2.wd);
 cocoon.request.setAttribute (form2, form2.form);
 
 I can see that if I call showForm() on either of these, the whole
 pageshould get displayed with both forms.  So, I went ahead and:
 
 form2.showForm (display-forms);
 
 Poofo, it works!  There's my page, with both forms, all styled like
 Iwant.
 
 Oops, no it doesn't.  When I click the submit button, I get this:
 
 Description:org.apache.cocoon.ProcessingException: Failed to execute
 pipeline.:org.xml.sax.SAXException: No form found at
 locationgetAttribute($request, 'form1').

That's because the request is an object that lives only for the duration
of one request. Thus if you put something in a request attribute, it
only remains there for the current request. The submit is a new request,
so you would have to put the forms back in the attributes on that new
request. But with the woody2.js this is rather hard, since you can't do
that AFAIK without modifications.

The whole woody-flowscript integration is quite focussed on displaying
one form at a time, so you're a bit on your own if you want to display
multiple forms... (not that it's impossible, but you'll have to write
some more code by your own)

snip/

-- 
Bruno Dumon http://outerthought.org/
Outerthought - Open Source, Java  XML Competence Support Center
[EMAIL PROTECTED]  [EMAIL PROTECTED]


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



Re: Need some help w/ Woody Template

2004-02-11 Thread Mark Lundquist
On Feb 11, 2004, at 12:54 AM, Bruno Dumon wrote:

That's because the request is an object that lives only for the 
duration
of one request. Thus if you put something in a request attribute, it
only remains there for the current request.
OK I figured that's what must be going on.

I'm new to Cocoon continuations and I had a bad think goin'.  I thought 
well, the request is part of the flow context, and a continuation 
ought to close over the entire context including the request.  But of 
course not... it's not that there's one request that gets suspended and 
resumed, it's that you have one request that inaugurates the flow, and 
another request(s) that resume it.  Yeah I get it :-)

The whole woody-flowscript integration is quite focussed on displaying
one form at a time, so you're a bit on your own if you want to display
multiple forms... (not that it's impossible, but you'll have to write
some more code by your own.
Right, I kind  of saw that coming :-)  I figure all the pieces are 
there in woody2.js, I'll just have to put them together differently.

thx-a-lot,
~ml
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: Need some help w/ Woody Template

2004-02-11 Thread Sylvain Wallez
Mark Lundquist wrote:

On Feb 11, 2004, at 12:54 AM, Bruno Dumon wrote:

That's because the request is an object that lives only for the 
duration of one request. Thus if you put something in a request 
attribute, it only remains there for the current request.


OK  I figured that's what must be going on.

I'm new to Cocoon continuations and I had a bad think goin'.  I 
thought well, the request is part of the flow context, and a 
continuation ought to close over the entire context including the 
request.  But of course not... it's not that there's one request that 
gets suspended and resumed, it's that you have one request that 
inaugurates the flow, and another request(s) that resume it.  Yeah I 
get it :-)


The simple rule is that only local variables of the script function are 
part of the continuation. Every object you access through the cocoon 
object is not part of the continuation and is likely to change when you 
cross a cocoon.sendPageAndWait().

The whole woody-flowscript integration is quite focussed on 
displaying one form at a time, so you're a bit on your own if you 
want to display multiple forms... (not that it's impossible, but 
you'll have to write some more code by your own.


Right, I kind  of saw that coming :-)  I figure all the pieces are 
there in woody2.js, I'll just have to put them together differently.


You can make use of the upcoming bookmark continuations in the 
upcoming 2.1.4 release. These are continuations that are not related to 
a sendPage and can therefore be used to go back at any particular 
location in your script. This allows to easily handle a previous 
button in a wizard.

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


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


Re: Need some help w/ Woody Template

2004-02-11 Thread Mark Lundquist
On Feb 11, 2004, at 1:03 PM, Sylvain Wallez wrote:

You can make use of the upcoming bookmark continuations in the 
upcoming 2.1.4 release. These are continuations that are not related 
to a sendPage and can therefore be used to go back at any particular 
location in your script. This allows to easily handle a previous 
button in a wizard.

Very nice!
~ml
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Need some help w/ Woody Template

2004-02-10 Thread Mark Lundquist
Hi all,

I need to put a couple of forms on a page.  The WoodyTemplateTransformer wiki page says the way to do this is to use the special @location attribute on wt:form-template>, to tell the transformer where to pick up the form instance.

It's kinda sketchy, but I think I can dig what they're getting at there.  So I did this:

wd:form-template
location=getAttribute($request, 'form1')
action=#{$continuation/id}.continue method=POST
>

...and then I went like this in my flow:

form1 = new Form (form1.wd);
cocoon.request.setAttribute (form1, form1.form);

form2 = new Form (form2.wd);
cocoon.request.setAttribute (form2, form2.form);

I can see that if I call showForm() on either of these, the whole page should get displayed with both forms.  So, I went ahead and:

form2.showForm (display-forms);

Poofo, it works!  There's my page, with both forms, all styled like I want.

Oops, no it doesn't.  When I click the submit button, I get this:

Description: org.apache.cocoon.ProcessingException: Failed to execute pipeline.: org.xml.sax.SAXException: No form found at location getAttribute($request, 'form1').

Sender: org.apache.cocoon.servlet.CocoonServlet

Source: Cocoon Servlet

Request URI
x-tad-smaller7652197982112f24115b4124565a28133b6b5a2d.continue


/x-tad-smallerI see in the source code that this is what WidgetReplacingPipe does when the value denoted by the JXPath expression in @location turns out to be null.  So how could it be null?  It had to have worked the first time, but somehow coming back in on the continuation, it doesn't.

So then I thought, Well, maybe I really need to be setting this attribute in the session context instead of the request context.  So, I changed it in my flow, and I changed it in my wd:form-template>.  Well, that made things worse.  This way, I get the SAXException right from the get-go (same exception: No form found at location...), I don't successfully display the page.

Can anybody tell me what I might be doing wrong?  I can't figure out why the getAttribute($session, 'form1') way isn't working at all, when doing it with $request worked at least a little bit! :-/.

Thanks a lot for any help,
~ml