You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Stephan Niedermeier <ma...@logabit.com> on 2003/09/06 16:51:47 UTC

JXForms+JXTemplates: Passing values

Hello,

I want to use JXForms for data binding and JXTemplate for displaying "non-form-datas". Is there a way to pass other values to the template over my Flow Script using the function form.sendView("target")? Now it seems to me, that only the form model can be passed to the template.

My Sitemap has the following lines:

...
<map:match pattern="">
      <map:call function="jxform">
        <map:parameter name="function" value="main"/>
        <map:parameter name="id" value="myForm"/>
     </map:call>
...
<map:match pattern="*.jxt">
      <map:generate type="jxt" src="documents/templates/{1}.jxt"/>
      <map:transform type="jxf" />
      <map:transform type="xalan" src="stylesheets/jxforms2html.xsl" />
      <map:serialize type="xhtml"/>
    </map:match>

My Flow Script:

cocoon.load("resource://org/apache/cocoon/components/jxforms/flow/javascript/JXForm.js");

function main(form) {

  // Model for the form
  var model = {"name" : "foo", "password" : "bar"};
  form.setModel(model);

  // How to pass this var into the template without using the setModel()???
  var someVar = "Hello Word!";
    
  form.sendView("listUsers.jxt");
}

Thank you!

Best regards
Stephan Niedermeier