Dynamic form definition, binding and templating is a very convenient way
to generate forms according to a DB structure that can change. It could
perhaps may be more efficient, in a performance point of view, to
generate files for definition/binding/template each time the DB
structures gets changed, then to read these files with a simple
generator. But we never had any performance drawback nor JVM heap space
problem.
Here's a sitemap snippet :
<map:match pattern="*/*.xhtml">
<map:call function="myForm">
<map:parameter name="form"
value="cocoon:/{1}/cforms/form.xml"/>
<map:parameter name="binding"
value="cocoon:/{1}/cforms/binding.xml"/>
<map:parameter name="show"
value="{1}/cforms/template.xml"/>
<map:parameter name="redirect" value="{2}.html"/>
<!-- document to edit -->
<map:parameter name="src" value="cocoon://{1}/{2}.xml"/>
</map:call>
</map:match>
Then, in the flowscript :
var redirect = cocoon.parameters.redirect;
// Form definition
var form = new Form(cocoon.parameters.form);
// Binding
form.createBinding(cocoon.parameters.binding);
var document = ...
// load document
form.load(document);
// The form to be shown
form.showForm(cocoon.parameters.show);
//... processing...
//... then
// save document
form.save(document);
cocoon.redirectTo(redirect, true);
André
Hi Andre,
thank you very much for that information. Do you ever run into memory and/or
JVM issues with your approach? Did you start generation out of flowscript?
Could you give a little example to get an idea about your approach?
Thanks an best regards,
Patrick
Hi,
I do use dynamic form definition, binding and templating to generate
forms with different structures.
Don't know if it is or was a NO GO, but it works pretty well.
Cheers.
André
Hello together!
In my current project I need to build CForms out of an evolutionary DB,
e.g. some entities change their attributes and behaviour. To reflect these
changes I am searching for a solution like [1]. Is this still a good path
to follow, or is the dynamic creation of form-definitions (and building
templates out of them) a NO GO! ??
By the way, inside [1] there is an Jira issue mentioned [2] wich affects
cocoon 2.1.8. The available patch is responsible for passing
flow-attributes through the Form constructor. Ist this feature build-in with
2.2 ?
Best regards,
Patrick
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]