cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Simone Gianni <s.gia...@thebug.it>
Subject Re: Cast type in flowscript [ Javaflow]
Date Mon, 27 Feb 2006 01:55:10 GMT
Andrew Madu wrote:

>
> sorry for being a pain but i'm still not clear about the form 
> implementation.
>
> var form = new Form("forms/register.xml");
> form.showForm("register1.xml", {"msg":Registermsg, "newOrderReg2" : 
> neworderreg2});
>
> becomes:
>
> FormInstance fi = new FormInstance("forms/register.xml");
>
> fi.createBinding("register1.xml",new VarMap()
> .add("msg":Registermsg)
> .add("newOrderReg2" : neworderreg2);

Nope. You have 2 files for each form, a definition and a template. 
Optionally you can have a binding. Also, you need a pipe in the sitemap 
to show the form. In javascript you use :

var form = new Form("definition");
form.showForm("pipe", {"key: variable});

in this case, you are not using a binding. So, this in javaflow is :

FormInstance fi = new FormInstance("definition");
fi.show("pipe", new VarMap().add("key", variable));

The fi.createBinding is used to assign a binding to the form instance. 
fi.load is used once you have a binding to "transfer" values from  a 
bean or xml document to widget fields, while fi.save transfers values 
from the form widgets to the bean or document.

> ---------------------------------------------------   
>                
> var model = form.getModel();
>
> becomes:
>
> fi.getModel model = fi.getModel(); ????

fi.getModel() returns a org.apache.cocoon.forms.formmodel.Form, that is 
the underlying form object. So you can do :

Form form = fi.getModel();
form.lookupWidget(.....).getValue();
etc..etc..

>
> many thanks 
>
> Andrew
>
Simone

-- 
Simone Gianni

Mime
View raw message