cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bart Molenkamp" <b.molenk...@bizzdesign.nl>
Subject RE: [sorry but not all done yet] RE: pass a variable from flowscript into cfrom text input field
Date Tue, 26 Oct 2004 12:20:26 GMT
I don't know if I get your question right, but this may help: I'm using
a similair approach in my project: first show form 1, then check for
some condition and see if it must show form 2, then show a page with
results with the option to edit the forms again. I've done it something
like:

form1 = new Form("form1.xml");
form1.createBinding("form1-binding.xml");

form2 = new Form("form2.xml");
form2.createBinding("form2-binding.xml");

var finished = false;
var data = ...; (your data)

while (!finished) {
  form1.showForm("form1.html");
  form1.save(data);

  if (data.isBla()) {
    form2.showForm("form2.html");
    form2.save(data);
  }

  cocoon.sendPageAndWait("result.html", data);
  finished = cocoon.request.getParameter("finished") == "true";
}

So in my case, I don't set any boolean fields on the form to figure out
if anything has changed.

But maybe I'm not understanding your question ;)

Bart.

> 
> sorry i was too fast...
> the solution
> 
> var test;
> 
> form = new Form("my-form.xml");
> wid = form.lookupWidget("test");
> wid.setValue(test);
> 
> form.showForm("registration-display-pipeline");
> var test = cocoon.request.test;
> 
> 
> only works fine with input field widgets but not with booleanfield
> widgets. There i get an error:
> 
> java.lang.RuntimeException: Cannot set value of boolean field "test"
to a
> non-Boolean value.
> 
> Same as with the text field i use it to figure out if it has been
> "changed"
> before and redisplay its old value... all to solve my multi page from
> problem.... user has enterd a falue in page 2 and submitetd it then
goes
> back to page 1 and changes something and submits page one. now i want
page
> 2
> to be displayed again but with the data entered before!
> 
> 
> thanks again!
> phil
> 
> 
> 
> 
> 
> 
> > thank you Bart it works now!
> >
> > what i like most about Cocoon
> > is the community of users and
> > developers! thanks guys!
> >
> > regards,
> > phil
> >
> >
> >
> >
> > > No, the code belongs to your flowscript.
> > >
> > > var name = "Cocoon";
> > >
> > > form = new Form("my-form.xml");
> > > wid = form.lookupWidget("name");
> > > wid.setValue(name);
> > >
> > > ...
> > >
> > > form.showForm("form-pipe");
> > >
> > > ...
> > >
> > > >
> > > > Thank you Bart, Gunter and Nacho!
> > > >
> > > > still i am not shure how to use this:
> > > >
> > > > nameWidget = form.lookupWidget("name");
> > > > nameWidget.setValue(name);
> > > >
> > > > can i put this in my Flowscript? Again i want to pass a variable
> > > > from a flowscript and set it as default value for the widget.
> > > > I guess the code above belongs in the cfrom template but how do
i
> pass
> > > the
> > > > variable "name" to it?
> > > >
> > > >
> > > > > and with v2 of the javascript API, you could write:
> > > > >
> > > > > var form = new Form("form1.xml");
> > > > > var wid = form.getWidget();
> > > > > wid.name.value = name;
> > > > >
> > > > uhh, how can i use version 2 of the javascript API?
> > > >
> > >
> > >
>
cocoon.load("resource://org/apache/cocoon/forms/flow/javascript/v2/Form.
> > > js");
> > >
> > > (ie load Form.js from the v2/ directory). But the code above
should
> work
> > > with the regular (version 1) Form.js
> > >
> > > >
> > > > Thanks again,
> > > > phil
> > > Bart
> > >
> > >
> > >
---------------------------------------------------------------------
> > > To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> > > For additional commands, e-mail: users-help@cocoon.apache.org
> > >
> >
> >
> >
---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> > For additional commands, e-mail: users-help@cocoon.apache.org
> >
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org


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


Mime
View raw message