You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Peter Flynn <pf...@ucc.ie> on 2007/01/05 16:47:14 UTC
Syntax of registration.js
I'm trying to get the Cforms demo to pass all the form field values to
the success pipeline, but I don't know the syntax of the registration.js
file. I have added what is intended to be a second definition to the var
viewData command, but it has no effect, and I don't know what delimiter
should be used between definitions, or if the command should be
constructed differently if you want more than one definition:
--------------------------------------------------------------------------
cocoon.load("resource://org/apache/cocoon/forms/flow/javascript/Form.js");
function registration() {
var form = new Form("registration_definition.xml");
form.showForm("registration-display-pipeline");
var viewData = { "username" : form.getChild("name").getValue()
"date" : form.getChild("date").getValue() }
cocoon.sendPage("registration-success-pipeline", viewData);
}
--------------------------------------------------------------------------
Incidentally, the original var viewData line did not end with a
semicolon. Should it?
///Peter
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
Writing form data to an XML file
Posted by Peter Flynn <pf...@ucc.ie>.
I'm passing the results of the form demo into some code in
registration_success.jx
to write the form data to an XML file. Having got it working, I now need
to find
out how to get rid of the text which appears in the browser after the
success message:
success entire source overwritten write overwritten
file:/usr/local/apache-tomcat-5.5.12/webapps/ROOT/myformtest/abc.xml xml
Obviously it's a trace from somewhere...but where? My
registration_success.jx says:
<?xml version="1.0"?>
<html>
<head>
<title>Registration successful</title>
</head>
<body>
<p>Registration was successful for ${username} on ${date}!</p>
<source:write xmlns:source="http://apache.org/cocoon/source/1.0">
<source:source>context://myformtest/${username}.xml</source:source>
<source:fragment>
<data>
<date yyyy-mm-dd="${date}"/>
</data>
</source:fragment>
</source:write>
</body>
</html>
///Peter
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
Re: Syntax of registration.js
Posted by Peter Flynn <pf...@ucc.ie>.
Peter Flynn wrote:
> I'm trying to get the Cforms demo to pass all the form field values to
> the success pipeline, but I don't know the syntax of the registration.js
> file.
Cancel that...sorry for the bandwidth. Turns out it's a comma; and no,
there is no need for a semicolon at the end of the var viewData command
(at least, it works without it).
///Peter
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
Re: Syntax of registration.js
Posted by Toby <to...@linux.it>.
Peter Flynn wrote:
> var viewData = { "username" : form.getChild("name").getValue()
> "date" : form.getChild("date").getValue() }
The correct syntax has a comma between the fields:
var viewData = { "username" : form.getChild("name").getValue(),
"date" : form.getChild("date").getValue() }
> I don't know the syntax of the registration.js file.
It's a language called JavaScript or ECMAScript. You can find all the
documentation you need on Google or you can buy a book.
> Incidentally, the original var viewData line did not end with a
> semicolon. Should it?
It's optional.
I never use it, but people accustomed to C/C++/Java seem to like it :-P
Toby
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org