You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Rashel Shehata <ra...@gmail.com> on 2007/04/18 04:02:52 UTC

dynamic cForm generation

Hey,

I'm trying to generate cocoon forms dynamically. atm I create the cForm
model xml dynamically using jx generator; this is what i have:

in my flowscript:
  cocoon.sendPage("form_model-pipeline.xsp" ,
     {questions: questionRegistry.getAllQuestions()});

and in my pipeline:
<map:match pattern="*-pipeline.xsp">
       <map:generate type="jx" src="forms/{1}.xml"/>
       <map:serialize type="xml"/>
     </map:match>

the jx generator creates a cForm xml model in correct syntax and is
outputted as XML to the browser...

what im trying to do now is feed this newly generated xml model to the
pipeline so that a Form will be generated and viewed, however i'm not really
sure how to do this, or which part of cocoon docos i sould be reading...
How do I dynamically generate input content to be used as a source in the
sitemap??


Any help would be appreciated...

Re: dynamic cForm generation

Posted by Dev at weitling <de...@weitling.net>.
Rashel Shehata wrote:
> what I was thinking of doing is using the output of a pipeline entry
> as an
> input for the form constructor.

Yes, but pipeline B must fetch the output of pipeline A by calling it.
(as I said: think pull, not push)

> so a call from flowscript:
>  cocoon.sendPage("form_model-pipeline.xsp" ,
>     {questions: questionRegistry.getAllQuestions()});
>
> will be matched with the pipeline entry:
>
> <map:match pattern="*-pipeline.xsp">
>    <map:generate type="jx" src="forms/{1}.xml"/>
>     <map:serialize type="xml"/>
>   </map:match>
>
> and the jx generator looks for the file: forms/form_model.xml.... which
> generates the form definition xml and ouputs into the browser

I was wondering because the path in the error message didn't fit.

> so instead of calling cocoon.sendPage(..) im trying to use the ouput
> of teh
> pipeline, i.e. the serialized xml, as a direct argument for the form
> constructor, i.e. by calling
>>  var form = new Form("form_model-pipeline.xsp" ,
>>     {questions: questionRegistry.getAllQuestions()});
>
> but it seems that form constructor only takes system files as an argument

No, that's not correct. But sometimes it helps (for preventing mistakes
and for better readability) to specify the protocol, e.g.

new Form("file:form_model-pipeline.xsp");    -> reads the file directly, or
new Form("cocoon:form_model-pipeline.xsp");    -> makes a call to the
appropriate pipeline

This way you can call a pipeline for creating a form definition dynamically.

Besides, that you can call also non-system files, Philippe's tip is
worth thinking about it and maybe extending it:
- Generate a definition containing all you need.
- Then deactivate all widgets yo don't need (status = disabled).
- And loading data into it dynamically via form binding.

Feel free to ask again - at the moment there is great weather here but
I'm stuck to my keyboard...
Florian

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


Re: dynamic cForm generation

Posted by Rashel Shehata <ra...@gmail.com>.
Hi,

form_model-pipeline.xsp is not a file...
what I was thinking of doing is using the output of a pipeline entry as an
input for the form constructor.
so a call from flowscript:
  cocoon.sendPage("form_model-pipeline.xsp" ,
     {questions: questionRegistry.getAllQuestions()});

will be matched with the pipeline entry:

<map:match pattern="*-pipeline.xsp">
    <map:generate type="jx" src="forms/{1}.xml"/>
     <map:serialize type="xml"/>
   </map:match>

and the jx generator looks for the file: forms/form_model.xml.... which
generates the form definition xml and ouputs into the browser

so instead of calling cocoon.sendPage(..) im trying to use the ouput of teh
pipeline, i.e. the serialized xml, as a direct argument for the form
constructor, i.e. by calling

>  var form = new Form("form_model-pipeline.xsp" ,
>     {questions: questionRegistry.getAllQuestions()});

but it seems that form constructor only takes system files as an argument

Any help as to what else I may try

Thanks
On 4/18/07, Dev at weitling <de...@weitling.net> wrote:

>
> > Hi Bart
> um, err, Florian...
>
> > Thanks for your help, but i have tried that path in the morning and
> > unfortunally was unsuccessful...
> > when i call
> >
> >  var form = new Form("form_model-pipeline.xsp" ,
> >     {questions: questionRegistry.getAllQuestions()});
> >
> > from my flowscipt, cocoon actually looks for the file "form_model-
> > pipeline.xsp" ,
> > so i get the fllowing file not found exception:
> >
> > java.io.FileNotFoundException:
> > C:\cocoon\build\webapp\test\forms\test\form_model-pipeline.xsp (The
> > system
> > cannot find the file specified)
>
> When I revisit your pipeline
> <map:match pattern="*-pipeline.xsp">
>     <map:generate type="jx" src="forms/{1}.xml"/>
>      <map:serialize type="xml"/>
>    </map:match>
> then I see it looks for this file in the folder "forms".
>
> Could you just provide your directory structure (files, folders,
> sitemap) and your sitemap content?
>
> Bye,
> _Florian_
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
>
>

Re: dynamic cForm generation

Posted by Dev at weitling <de...@weitling.net>.
> Hi Bart
um, err, Florian...

> Thanks for your help, but i have tried that path in the morning and
> unfortunally was unsuccessful...
> when i call
>
>  var form = new Form("form_model-pipeline.xsp" ,
>     {questions: questionRegistry.getAllQuestions()});
>
> from my flowscipt, cocoon actually looks for the file "form_model-
> pipeline.xsp" ,
> so i get the fllowing file not found exception:
>
> java.io.FileNotFoundException:
> C:\cocoon\build\webapp\test\forms\test\form_model-pipeline.xsp (The
> system
> cannot find the file specified)

When I revisit your pipeline
<map:match pattern="*-pipeline.xsp">
     <map:generate type="jx" src="forms/{1}.xml"/>
      <map:serialize type="xml"/>
    </map:match>
then I see it looks for this file in the folder "forms".

Could you just provide your directory structure (files, folders,
sitemap) and your sitemap content?

Bye,
_Florian_

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


Re: dynamic cForm generation

Posted by Rashel Shehata <ra...@gmail.com>.
Hi Bart
Thanks for your help, but i have tried that path in the morning and
unfortunally was unsuccessful...
when i call

  var form = new Form("form_model-pipeline.xsp" ,
     {questions: questionRegistry.getAllQuestions()});

from my flowscipt, cocoon actually looks for the file "form_model-
pipeline.xsp" ,
so i get the fllowing file not found exception:

java.io.FileNotFoundException:
C:\cocoon\build\webapp\test\forms\test\form_model-pipeline.xsp (The system
cannot find the file specified)

so i think that the aregument of the form constructor is not matched with
the sitemap...

any other help???

thanks again
On 4/18/07, Dev at weitling <de...@weitling.net> wrote:
>
> Seems we are visited by an old friend - the "Think pull, not push"
> discussion :-)
>
> You can't call the pipelines for definition and display to save them for
> later use. Or differently explained: You can't feed them to a pipeline.
> But you can make a pipeline calling another pipeline which provides its
> results. Completely baffled?
>
> Well, in flowscript it looks like this (incomplete, though):
>
> function myFormFlow () {
> var form = new Form("my-definition-pipeline");
> form.showForm("my-template-pipeline");
> }
>
> In your case this rewrites to:
>
> function myFormFlow () {
> var form = new Form("form_model-pipeline.xsp");
> form.showForm("form_templateToXxml-pipeline.xsp");
> }
>
> Important:
> - in these pipeline calls you may use any of the supported protocols
> - cocoon.sendPage() sends a page to the browser
>
> Hope I put you on the right track :-) Otherwise keep on asking (maybe
> there's someone around here better in pedagogics ;-)
>
> Florian
>
> > I dynamically create the form definition and template by calling 2
> > seperate
> > flowscript functions:
> >
> > function create_form_def(){
> >
> >  cocoon.sendPage("form_model-pipeline.xsp" ,
> >     {questions: questionRegistry.getAllQuestions()});
> >
> >  }
> > function create_form_template(){
> >
> >  cocoon.sendPage("form_templateToXml-pipeline.xsp");
> >  }
> >
> > both functions refer to the same pipeline entry:
> > <map:match pattern="*-pipeline.xsp">
> >      <map:generate type="jx" src="forms/{1}.xml"/>
> >       <map:serialize type="xml"/>
> >     </map:match>
> >
> > the jx generator creates both the xml form definition and template
> > correctly. I now want to take the generated definition and template
> > and feed
> > it back into the cocoon pipeline so that I may view the generated form.
> >
> > I've been looking at two options:
> > 1. saving the serialized xml output from my generator as a file and
> using
> > that file and the default generator to start the pipeline: I have been
> > looking at the source Writing Transformer (is that a good option? is
> > there
> > another way to save  )
> >
> > 2. or rather than saving the serialized xml into physical space, to
> > somehow
> > dynamically feed both serialized xml from the generator (the
> > definition and
> > template) into a new pipeline entry to display the cocoon form...
> >
> > those are the 2 thoughts i have atm, but i'm having problems
> > implementing,
> > I'm not sure if i'm on the right track..
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
>
>

Re: dynamic cForm generation

Posted by Dev at weitling <de...@weitling.net>.
Seems we are visited by an old friend - the "Think pull, not push"
discussion :-)

You can't call the pipelines for definition and display to save them for
later use. Or differently explained: You can't feed them to a pipeline.
But you can make a pipeline calling another pipeline which provides its
results. Completely baffled?

Well, in flowscript it looks like this (incomplete, though):

function myFormFlow () {
  var form = new Form("my-definition-pipeline");
  form.showForm("my-template-pipeline");
}

In your case this rewrites to:

function myFormFlow () {
  var form = new Form("form_model-pipeline.xsp");
  form.showForm("form_templateToXxml-pipeline.xsp");
}

Important:
- in these pipeline calls you may use any of the supported protocols
- cocoon.sendPage() sends a page to the browser

Hope I put you on the right track :-) Otherwise keep on asking (maybe
there's someone around here better in pedagogics ;-)

Florian

> I dynamically create the form definition and template by calling 2
> seperate
> flowscript functions:
>
> function create_form_def(){
>
>  cocoon.sendPage("form_model-pipeline.xsp" ,
>     {questions: questionRegistry.getAllQuestions()});
>
>  }
> function create_form_template(){
>
>  cocoon.sendPage("form_templateToXml-pipeline.xsp");
>  }
>
> both functions refer to the same pipeline entry:
> <map:match pattern="*-pipeline.xsp">
>      <map:generate type="jx" src="forms/{1}.xml"/>
>       <map:serialize type="xml"/>
>     </map:match>
>
> the jx generator creates both the xml form definition and template
> correctly. I now want to take the generated definition and template
> and feed
> it back into the cocoon pipeline so that I may view the generated form.
>
> I've been looking at two options:
> 1. saving the serialized xml output from my generator as a file and using
> that file and the default generator to start the pipeline: I have been
> looking at the source Writing Transformer (is that a good option? is
> there
> another way to save  )
>
> 2. or rather than saving the serialized xml into physical space, to
> somehow
> dynamically feed both serialized xml from the generator (the
> definition and
> template) into a new pipeline entry to display the cocoon form...
>
> those are the 2 thoughts i have atm, but i'm having problems
> implementing,
> I'm not sure if i'm on the right track..

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


Re: dynamic cForm generation

Posted by Rashel Shehata <ra...@gmail.com>.
Hi Florian
I dynamically create the form definition and template by calling 2 seperate
flowscript functions:

 function create_form_def(){

  cocoon.sendPage("form_model-pipeline.xsp" ,
     {questions: questionRegistry.getAllQuestions()});

  }
 function create_form_template(){

  cocoon.sendPage("form_templateToXml-pipeline.xsp");
  }

both functions refer to the same pipeline entry:
 <map:match pattern="*-pipeline.xsp">
      <map:generate type="jx" src="forms/{1}.xml"/>
       <map:serialize type="xml"/>
     </map:match>

the jx generator creates both the xml form definition and template
correctly. I now want to take the generated definition and template and feed
it back into the cocoon pipeline so that I may view the generated form.

I've been looking at two options:
1. saving the serialized xml output from my generator as a file and using
that file and the default generator to start the pipeline: I have been
looking at the source Writing Transformer (is that a good option? is there
another way to save  )

2. or rather than saving the serialized xml into physical space, to somehow
dynamically feed both serialized xml from the generator (the definition and
template) into a new pipeline entry to display the cocoon form...

those are the 2 thoughts i have atm, but i'm having problems implementing,
I'm not sure if i'm on the right track..

Hopefully i explained my problem well enough... Thanks alot for your help

Regards

On 4/18/07, Dev at weitling <de...@weitling.net> wrote:
>
> Hi Rashel,
>
> > I'm trying to generate cocoon forms dynamically. atm I create the cForm
> > model xml dynamically
> Do you mean the form definition?
>
> > using jx generator; this is what i have:
> >
> > in my flowscript:
> >  cocoon.sendPage("form_model-pipeline.xsp" ,
> >     {questions: questionRegistry.getAllQuestions()});
> >
> > and in my pipeline:
> > <map:match pattern="*-pipeline.xsp">
> >       <map:generate type="jx" src="forms/{1}.xml"/>
> >       <map:serialize type="xml"/>
> >     </map:match>
>
> I propose calling it form_model-pipeline.jx rather than .xsp 'cause
> that's different.
>
> > the jx generator creates a cForm xml model in correct syntax and is
> > outputted as XML to the browser...
> You need two things: A definition and a template. The definition
> declares the available fields and its types. The template is used for
> the arrangement and display of these fields.
>
> > what im trying to do now is feed this newly generated xml model to the
> > pipeline so that a Form will be generated and viewed, however i'm not
> > really
> > sure how to do this, or which part of cocoon docos i sould be reading...
> Please have a look at
> http://cocoon.apache.org/2.1/userdocs/basics/index.html
> I think (I hope ;-) this helps understanding the concepts. And then feel
> free to ask again.
>
> > How do I dynamically generate input content to be used as a source in
> the
> > sitemap??
> In short: You may use every cocoon protocol (context:, cocoon:, file:,
> http:, ...) as xml input and therefore any pipeline, even those creating
> content dynamically.
>
> > Any help would be appreciated...
> I hope, this helped :-)
> Florian
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
>
>

Re: dynamic cForm generation

Posted by Dev at weitling <de...@weitling.net>.
Hi Rashel,

> I'm trying to generate cocoon forms dynamically. atm I create the cForm
> model xml dynamically 
Do you mean the form definition?

> using jx generator; this is what i have:
>
> in my flowscript:
>  cocoon.sendPage("form_model-pipeline.xsp" ,
>     {questions: questionRegistry.getAllQuestions()});
>
> and in my pipeline:
> <map:match pattern="*-pipeline.xsp">
>       <map:generate type="jx" src="forms/{1}.xml"/>
>       <map:serialize type="xml"/>
>     </map:match>

I propose calling it form_model-pipeline.jx rather than .xsp 'cause
that's different.

> the jx generator creates a cForm xml model in correct syntax and is
> outputted as XML to the browser...
You need two things: A definition and a template. The definition
declares the available fields and its types. The template is used for
the arrangement and display of these fields.

> what im trying to do now is feed this newly generated xml model to the
> pipeline so that a Form will be generated and viewed, however i'm not
> really
> sure how to do this, or which part of cocoon docos i sould be reading...
Please have a look at
http://cocoon.apache.org/2.1/userdocs/basics/index.html
I think (I hope ;-) this helps understanding the concepts. And then feel
free to ask again.

> How do I dynamically generate input content to be used as a source in the
> sitemap??
In short: You may use every cocoon protocol (context:, cocoon:, file:,
http:, ...) as xml input and therefore any pipeline, even those creating
content dynamically.

> Any help would be appreciated...
I hope, this helped :-)
Florian

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


Re: dynamic cForm generation

Posted by Rashel Shehata <ra...@gmail.com>.
Hi,
after looking at the patch provided at:
https://issues.apache.org/jira/browse/COCOON-1418

I thought it was a bit drastic to change cocoon source code, and also will
cause portability issues...
so to fix my issue, i place the data structures that my jx generator uses in
a session variables, that way when i call form constructor, i dont ned to
pass it an object...
this is what i have so far:
in my flowscript:

function do_finalPreview(){

 cocoon.session.setAttribute("questions",questionRegistry.getAllQuestions()
);
 cocoon.session.setAttribute("style",questionRegistry.getStyle() );
   var form = new Form("cocoon:/form_model-pipeline.xsp");

  form.showForm("finalPreview-display-pipeline");

 }
in the sitemap, the relevant entries are:

     <map:match pattern="*-pipeline.xsp">
       <map:generate type="jx" src="forms/{1}.xml"/>
       <map:serialize type="xml"/>
     </map:match>
which generates the serialized xml for form definition and

     <map:match pattern="finalPreview-display-pipeline">
       <map:generate src="cocoon:/form_templateToXml-pipeline.xsp"/>
       <map:transform type="forms" label="content1"/>
       <map:transform type="i18n">
       </map:transform>
       <map:call resource="simple-page2html">
         <map:parameter name="file" value="cocoon:/form_templateToXml-
pipeline.xsp"/>
       </map:call>
       <map:transform src="resources/forms-samples-styling.xsl">
         <map:parameter name="resources-uri"
value="{request:contextPath}/_cocoon/resources"/>
       </map:transform>
       <map:transform type="i18n">
       </map:transform>
       <map:serialize/>
     </map:match>
the src used for the generator
(src="cocoon:/form_templateToXml-pipeline.xsp") refers
to another pipeline entry which genrates the seialized xml for
form template,

I'm having a problem with this form generation.... when the form is
displayed, the section groups are displayed probably (fieldset|div or tab
style, and group labels etc) however the widgets within the groups are not
been displayed at all...
I tested the generated form def and template statistically and found that
the same problem occurs. After reviewing, I found that by adding the tag:
  <jx:import uri="resource://org/apache/cocoon/forms/generation/jx-
macros.xml"/>
to the form template will cause the form to display probably.
Adding this tag however to my jx generator for teh form template gives me
this error:

org.apache.cocoon.forms.FormsRuntimeException: The template cannot find a
form object
*<jx:set>* - resource://org/apache/cocoon/forms/generation/jx-macros.xml -
49:117


a snippet of my jx generatot for the form template is:

<?xml version="1.0"?>
<page xmlns:ft="http://apache.org/cocoon/forms/1.0#template"
      xmlns:fi="http://apache.org/cocoon/forms/1.0#instance"
      xmlns:jx="http://apache.org/cocoon/templates/jx/1.0"
   >
  <jx:import uri="resource://org/apache/cocoon/forms/generation/jx-
macros.xml"/>

  <content>
   <ft:form-template action="continue" method="POST">
   <jx:forEach var="section" items="${cocoon.session.getAttribute
('style')}">
<jx:choose>
...

Can anyone explain this problem to me? I dont really get what's happening



Thanks a million



On 4/19/07, Rashel Shehata <ra...@gmail.com> wrote:
>
> Hi,
> Thank you all for all the help...
> I am trying the suggestion found in  https://issues.apache.org/jira/browse/COCOON-1418
>
> so many thanks for the hint
>
> Regards
>
>
>  On 4/18/07, Jason Johnston <co...@lojjic.net> wrote:
> >
> > Philippe Gauthier - INSERM SIRH wrote:
> > >   Hi Rashel,
> > >
> > > U shouldn't use a dynamic form definition, because it means for each
> > > call, cocoon will have to compile a new form and can't use any
> > caching.
> > > I did the same mistake using xslt transformation to generate the
> > > definition (using pipelineToStream to save it to disk temporary) and
> > it
> > > killed the JVM eventually .
> > > And that's why the form instantiation function takes only system file.
> > >
> > > Instead u have to understand the binding concepts of forms an redesign
> > a
> > > or some generic forms definition and templates with more complex
> > widgets.
> > > Then u'll be have able to fill thoses forms with dynamic data.
> > > I hope I gave U the right pointers, sorry for my english.
> >
> > I agree that it's preferable to have a static form definition with
> > dynamic widgets that modify the structure of the form at runtime.  But
> > there are cases where that's not possible, so true dynamic form creation
> > is a useful tool to have.
> >
> > What you say about caching the form definition is also true but is only
> > an issue if the pipeline that generates it is not cacheable.  If all of
> > that pipeline's components are cacheable then the form definition is
> > cached IIUC.
> >
> > Rashel, what you are looking for I believe is this:
> >
> >   var form = new Form("cocoon:/my-dynamic-form-def-pipeline");
> >
> > That uses the result of a Cocoon pipeline to build the form definition.
> > Unfortunately, currently the Form constructor does not allow passing
> > flow attributes as a second argument; there is an open issue in Jira for
> > adding that feature: https://issues.apache.org/jira/browse/COCOON-1418
> >
> > In the absence of that feature you can pass along the data in another
> > way, for instance setting it as an attribute on the request.  Or you
> > could try applying the patch attached to that Jira issue.
> >
> > Finally, if you're using JX to generate the definition XML, I'd strongly
> >
> > suggest using jx:cache-key and jx:cache-validity to control the caching
> > of the result if possible, that way you'll avoid the performance/memory
> > issue Philippe warned of.  This feature might only be available in the
> > 'newjx' version of JXTemplateGenerator; details at
> > http://wiki.apache.org/cocoon/JXTemplateGenerator
> >
> > --Jason
> >
> > >
> > > regards,
> > >
> > > Philippe
> > >
> > > Rashel Shehata a écrit :
> > >> Hi Bart,
> > >> Ok so  to create the form definition xml the jx generator uses the
> > >> following xml file:
> > >> I pass it an array object ( questionRegistry.getAllQuestions()) that
> > >> contains a list of all the questions to be created in the form
> > >>
> > >> <?xml version="1.0"?>
> > >> <fd:form xmlns:fd=" http://apache.org/cocoon/forms/1.0#definition"
> > >>          xmlns:i18n=" http://apache.org/cocoon/i18n/2.1"
> > >>     xmlns:jx=" http://apache.org/cocoon/templates/jx/1.0">
> > >>
> > >>
> > >> <fd:widgets>
> > >>
> > >>    <jx:forEach var="question" items="${questions}">
> > >>
> > >>    <jx:choose>
> > >>  <jx:when test="${question.responseType == 'multivalue-field'}">
> > >>   <fd:multivaluefield id='${question.ID}'
> > >> required='${ question.required}' state='${question.state}'>
> > >>     <fd:label>     ${question.label} </fd:label>
> > >>     <fd:help>${ question.help}</fd:help>
> > >>        <fd:hint>${ question.hint}</fd:hint>
> > >>      <fd:datatype base="long"></fd:datatype>
> > >>      <fd:selection-list>
> > >>      <jx:forEach var="response" items="${ question.responses}">
> > >>      <fd:item value='${response.ID}'>
> > >>         <fd:label>${response.label}</fd:label>
> > >>         </fd:item>
> > >>
> > >>    </jx:forEach>
> > >>    </fd:selection-list>
> > >>   </fd:multivaluefield>
> > >>
> > >>   </jx:when>
> > >>
> > >>   <jx:when test="${question.responseType == 'checkbox'}">
> > >>   <fd:booleanfield id='${question.ID}' required='${
> > >> question.required}' state='${question.state}'>
> > >>     <fd:label>     ${question.label} </fd:label>
> > >>     <fd:help>${question.help}</fd:help>
> > >>        <fd:hint>${question.hint }</fd:hint>
> > >>    </fd:booleanfield>
> > >>
> > >>   </jx:when>
> > >>
> > >>  <jx:otherwise>
> > >>    <fd:field id='${question.ID}' required='${question.required}'
> > >> state='${question.state}'>
> > >>        <fd:label>     ${ question.label} ${question.responseType }
> > >> </fd:label>
> > >>     <fd:help>${question.help}</fd:help>
> > >>        <fd:hint>${question.hint}</fd:hint>
> > >>
> > >> ...
> > >>
> > >>   </fd:field>
> > >>  </jx:otherwise>
> > >>    </jx:choose>
> > >>    </jx:forEach>
> > >>  </fd:widgets>
> > >>  </fd:form>
> > >>
> > >>
> > >>
> > >>
> > >> the jx generator then outputs the serialized xml to the browser,
> > where
> > >> the xml is in correct cForm syntax... it's similar for the
> > >> form template also...
> > >>
> > >> I now want to do use both serialized xml and feed it back into a
> > >> pipeline entry so i can view the generated form as a HTML form...
> > >>
> > >>
> > >>
> > >> I hope this made my problem clearer..
> > >>
> > >>
> > >>
> > >> Thanks heaps
> > >>
> > >> On 4/18/07, *bart remmerie* <remmerie@gmail.com
> > >> <mailto: remmerie@gmail.com>> wrote:
> > >>
> > >>     Dear Rashel,
> > >>
> > >>     Could you give an example/snippet of one of these .xml files ?
> > >>
> > >>     Bart
> > >>
> > >>     2007/4/18, Rashel Shehata < rashel.s@gmail.com
> > >>     <ma...@gmail.com>>:
> > >>
> > >>         Hey,
> > >>
> > >>         I'm trying to generate cocoon forms dynamically. atm I create
> >
> > >>         the cForm model xml dynamically using jx generator; this is
> > >>         what i have:
> > >>
> > >>         in my flowscript:
> > >>           cocoon.sendPage("form_model-pipeline.xsp " ,
> > >>              {questions: questionRegistry.getAllQuestions()});
> > >>
> > >>         and in my pipeline:
> > >>         <map:match pattern="*-pipeline.xsp">
> > >>                <map:generate type="jx" src="forms/{1}.xml"/>
> > >>                <map:serialize type="xml"/>
> > >>              </map:match>
> > >>
> > >>         the jx generator creates a cForm xml model in correct syntax
> > >>         and is outputted as XML to the browser...
> > >>
> > >>         what im trying to do now is feed this newly generated xml
> > >>         model to the pipeline so that a Form will be generated and
> > >>         viewed, however i'm not really sure how to do this, or which
> > >>         part of cocoon docos i sould be reading...
> > >>         How do I dynamically generate input content to be used as a
> > >>         source in the sitemap??
> > >>
> > >>
> > >>         Any help would be appreciated...
> > >>
> > >>
> > >>
> > >>
> > >>
> > >>
> > >>     --
> > >>     Bart Remmerie
> > >>
> > >>
> > >
> > >
> > > --
> > > Philippe Gauthier
> > > INSERM
> > > DRH - SIRH
> > > Tel: 01.44.23.62.57
> > >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> > For additional commands, e-mail: users-help@cocoon.apache.org
> >
> >
>

Re: dynamic cForm generation

Posted by Rashel Shehata <ra...@gmail.com>.
Hi,
Thank you all for all the help...
I am trying the suggestion found in
https://issues.apache.org/jira/browse/COCOON-1418
so many thanks for the hint

Regards


On 4/18/07, Jason Johnston <co...@lojjic.net> wrote:
>
> Philippe Gauthier - INSERM SIRH wrote:
> >   Hi Rashel,
> >
> > U shouldn't use a dynamic form definition, because it means for each
> > call, cocoon will have to compile a new form and can't use any caching.
> > I did the same mistake using xslt transformation to generate the
> > definition (using pipelineToStream to save it to disk temporary) and it
> > killed the JVM eventually .
> > And that's why the form instantiation function takes only system file.
> >
> > Instead u have to understand the binding concepts of forms an redesign a
> > or some generic forms definition and templates with more complex
> widgets.
> > Then u'll be have able to fill thoses forms with dynamic data.
> > I hope I gave U the right pointers, sorry for my english.
>
> I agree that it's preferable to have a static form definition with
> dynamic widgets that modify the structure of the form at runtime.  But
> there are cases where that's not possible, so true dynamic form creation
> is a useful tool to have.
>
> What you say about caching the form definition is also true but is only
> an issue if the pipeline that generates it is not cacheable.  If all of
> that pipeline's components are cacheable then the form definition is
> cached IIUC.
>
> Rashel, what you are looking for I believe is this:
>
>   var form = new Form("cocoon:/my-dynamic-form-def-pipeline");
>
> That uses the result of a Cocoon pipeline to build the form definition.
> Unfortunately, currently the Form constructor does not allow passing
> flow attributes as a second argument; there is an open issue in Jira for
> adding that feature: https://issues.apache.org/jira/browse/COCOON-1418
>
> In the absence of that feature you can pass along the data in another
> way, for instance setting it as an attribute on the request.  Or you
> could try applying the patch attached to that Jira issue.
>
> Finally, if you're using JX to generate the definition XML, I'd strongly
> suggest using jx:cache-key and jx:cache-validity to control the caching
> of the result if possible, that way you'll avoid the performance/memory
> issue Philippe warned of.  This feature might only be available in the
> 'newjx' version of JXTemplateGenerator; details at
> http://wiki.apache.org/cocoon/JXTemplateGenerator
>
> --Jason
>
> >
> > regards,
> >
> > Philippe
> >
> > Rashel Shehata a écrit :
> >> Hi Bart,
> >> Ok so  to create the form definition xml the jx generator uses the
> >> following xml file:
> >> I pass it an array object (questionRegistry.getAllQuestions()) that
> >> contains a list of all the questions to be created in the form
> >>
> >> <?xml version="1.0"?>
> >> <fd:form xmlns:fd="http://apache.org/cocoon/forms/1.0#definition"
> >>          xmlns:i18n=" http://apache.org/cocoon/i18n/2.1"
> >>     xmlns:jx="http://apache.org/cocoon/templates/jx/1.0">
> >>
> >>
> >> <fd:widgets>
> >>
> >>    <jx:forEach var="question" items="${questions}">
> >>
> >>    <jx:choose>
> >>  <jx:when test="${question.responseType == 'multivalue-field'}">
> >>   <fd:multivaluefield id='${question.ID}'
> >> required='${question.required}' state='${question.state}'>
> >>     <fd:label>     ${question.label} </fd:label>
> >>     <fd:help>${ question.help}</fd:help>
> >>        <fd:hint>${question.hint}</fd:hint>
> >>      <fd:datatype base="long"></fd:datatype>
> >>      <fd:selection-list>
> >>      <jx:forEach var="response" items="${ question.responses}">
> >>      <fd:item value='${response.ID}'>
> >>         <fd:label>${response.label}</fd:label>
> >>         </fd:item>
> >>
> >>    </jx:forEach>
> >>    </fd:selection-list>
> >>   </fd:multivaluefield>
> >>
> >>   </jx:when>
> >>
> >>   <jx:when test="${question.responseType == 'checkbox'}">
> >>   <fd:booleanfield id='${question.ID}' required='${
> >> question.required}' state='${question.state}'>
> >>     <fd:label>     ${question.label} </fd:label>
> >>     <fd:help>${question.help}</fd:help>
> >>        <fd:hint>${question.hint }</fd:hint>
> >>    </fd:booleanfield>
> >>
> >>   </jx:when>
> >>
> >>  <jx:otherwise>
> >>    <fd:field id='${question.ID}' required='${question.required}'
> >> state='${question.state}'>
> >>        <fd:label>     ${question.label} ${question.responseType }
> >> </fd:label>
> >>     <fd:help>${question.help}</fd:help>
> >>        <fd:hint>${question.hint}</fd:hint>
> >>
> >> ...
> >>
> >>   </fd:field>
> >>  </jx:otherwise>
> >>    </jx:choose>
> >>    </jx:forEach>
> >>  </fd:widgets>
> >>  </fd:form>
> >>
> >>
> >>
> >>
> >> the jx generator then outputs the serialized xml to the browser, where
> >> the xml is in correct cForm syntax... it's similar for the
> >> form template also...
> >>
> >> I now want to do use both serialized xml and feed it back into a
> >> pipeline entry so i can view the generated form as a HTML form...
> >>
> >>
> >>
> >> I hope this made my problem clearer..
> >>
> >>
> >>
> >> Thanks heaps
> >>
> >> On 4/18/07, *bart remmerie* <remmerie@gmail.com
> >> <ma...@gmail.com>> wrote:
> >>
> >>     Dear Rashel,
> >>
> >>     Could you give an example/snippet of one of these .xml files ?
> >>
> >>     Bart
> >>
> >>     2007/4/18, Rashel Shehata <rashel.s@gmail.com
> >>     <ma...@gmail.com>>:
> >>
> >>         Hey,
> >>
> >>         I'm trying to generate cocoon forms dynamically. atm I create
> >>         the cForm model xml dynamically using jx generator; this is
> >>         what i have:
> >>
> >>         in my flowscript:
> >>           cocoon.sendPage("form_model-pipeline.xsp" ,
> >>              {questions: questionRegistry.getAllQuestions()});
> >>
> >>         and in my pipeline:
> >>         <map:match pattern="*-pipeline.xsp">
> >>                <map:generate type="jx" src="forms/{1}.xml"/>
> >>                <map:serialize type="xml"/>
> >>              </map:match>
> >>
> >>         the jx generator creates a cForm xml model in correct syntax
> >>         and is outputted as XML to the browser...
> >>
> >>         what im trying to do now is feed this newly generated xml
> >>         model to the pipeline so that a Form will be generated and
> >>         viewed, however i'm not really sure how to do this, or which
> >>         part of cocoon docos i sould be reading...
> >>         How do I dynamically generate input content to be used as a
> >>         source in the sitemap??
> >>
> >>
> >>         Any help would be appreciated...
> >>
> >>
> >>
> >>
> >>
> >>
> >>     --
> >>     Bart Remmerie
> >>
> >>
> >
> >
> > --
> > Philippe Gauthier
> > INSERM
> > DRH - SIRH
> > Tel: 01.44.23.62.57
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
>
>

Re: dynamic cForm generation

Posted by Jason Johnston <co...@lojjic.net>.
Philippe Gauthier - INSERM SIRH wrote:
>   Hi Rashel,
> 
> U shouldn't use a dynamic form definition, because it means for each 
> call, cocoon will have to compile a new form and can't use any caching.
> I did the same mistake using xslt transformation to generate the 
> definition (using pipelineToStream to save it to disk temporary) and it 
> killed the JVM eventually .
> And that's why the form instantiation function takes only system file.
> 
> Instead u have to understand the binding concepts of forms an redesign a 
> or some generic forms definition and templates with more complex widgets.
> Then u'll be have able to fill thoses forms with dynamic data.
> I hope I gave U the right pointers, sorry for my english.

I agree that it's preferable to have a static form definition with 
dynamic widgets that modify the structure of the form at runtime.  But 
there are cases where that's not possible, so true dynamic form creation 
is a useful tool to have.

What you say about caching the form definition is also true but is only 
an issue if the pipeline that generates it is not cacheable.  If all of 
that pipeline's components are cacheable then the form definition is 
cached IIUC.

Rashel, what you are looking for I believe is this:

   var form = new Form("cocoon:/my-dynamic-form-def-pipeline");

That uses the result of a Cocoon pipeline to build the form definition. 
  Unfortunately, currently the Form constructor does not allow passing 
flow attributes as a second argument; there is an open issue in Jira for 
adding that feature: https://issues.apache.org/jira/browse/COCOON-1418

In the absence of that feature you can pass along the data in another 
way, for instance setting it as an attribute on the request.  Or you 
could try applying the patch attached to that Jira issue.

Finally, if you're using JX to generate the definition XML, I'd strongly 
suggest using jx:cache-key and jx:cache-validity to control the caching 
of the result if possible, that way you'll avoid the performance/memory 
issue Philippe warned of.  This feature might only be available in the 
'newjx' version of JXTemplateGenerator; details at 
http://wiki.apache.org/cocoon/JXTemplateGenerator

--Jason

> 
> regards,
> 
> Philippe
> 
> Rashel Shehata a écrit :
>> Hi Bart,
>> Ok so  to create the form definition xml the jx generator uses the 
>> following xml file:
>> I pass it an array object (questionRegistry.getAllQuestions()) that 
>> contains a list of all the questions to be created in the form
>>
>> <?xml version="1.0"?>
>> <fd:form xmlns:fd="http://apache.org/cocoon/forms/1.0#definition"
>>          xmlns:i18n=" http://apache.org/cocoon/i18n/2.1"
>>     xmlns:jx="http://apache.org/cocoon/templates/jx/1.0">
>>
>>
>> <fd:widgets>
>>   
>>    <jx:forEach var="question" items="${questions}">
>>   
>>    <jx:choose>
>>  <jx:when test="${question.responseType == 'multivalue-field'}">
>>   <fd:multivaluefield id='${question.ID}' 
>> required='${question.required}' state='${question.state}'>
>>     <fd:label>     ${question.label} </fd:label>
>>     <fd:help>${ question.help}</fd:help>
>>        <fd:hint>${question.hint}</fd:hint>
>>      <fd:datatype base="long"></fd:datatype>
>>      <fd:selection-list>
>>      <jx:forEach var="response" items="${ question.responses}">
>>      <fd:item value='${response.ID}'>
>>         <fd:label>${response.label}</fd:label>
>>         </fd:item>
>>   
>>    </jx:forEach>
>>    </fd:selection-list>
>>   </fd:multivaluefield>
>>   
>>   </jx:when>
>>  
>>   <jx:when test="${question.responseType == 'checkbox'}">
>>   <fd:booleanfield id='${question.ID}' required='${ 
>> question.required}' state='${question.state}'>
>>     <fd:label>     ${question.label} </fd:label>
>>     <fd:help>${question.help}</fd:help>
>>        <fd:hint>${question.hint }</fd:hint>
>>    </fd:booleanfield>
>>
>>   </jx:when>
>>
>>  <jx:otherwise>
>>    <fd:field id='${question.ID}' required='${question.required}' 
>> state='${question.state}'>
>>        <fd:label>     ${question.label} ${question.responseType } 
>> </fd:label>
>>     <fd:help>${question.help}</fd:help>
>>        <fd:hint>${question.hint}</fd:hint>
>>
>> ...
>>
>>   </fd:field>
>>  </jx:otherwise>  
>>    </jx:choose>
>>    </jx:forEach>
>>  </fd:widgets>
>>  </fd:form>
>>  
>>
>>  
>>
>> the jx generator then outputs the serialized xml to the browser, where 
>> the xml is in correct cForm syntax... it's similar for the 
>> form template also...
>>
>> I now want to do use both serialized xml and feed it back into a  
>> pipeline entry so i can view the generated form as a HTML form...
>>
>>  
>>
>> I hope this made my problem clearer..
>>
>>  
>>
>> Thanks heaps
>>
>> On 4/18/07, *bart remmerie* <remmerie@gmail.com 
>> <ma...@gmail.com>> wrote:
>>
>>     Dear Rashel,
>>
>>     Could you give an example/snippet of one of these .xml files ?
>>
>>     Bart
>>
>>     2007/4/18, Rashel Shehata <rashel.s@gmail.com
>>     <ma...@gmail.com>>:
>>
>>         Hey,
>>          
>>         I'm trying to generate cocoon forms dynamically. atm I create
>>         the cForm model xml dynamically using jx generator; this is
>>         what i have:
>>          
>>         in my flowscript:
>>           cocoon.sendPage("form_model-pipeline.xsp" ,
>>              {questions: questionRegistry.getAllQuestions()});
>>          
>>         and in my pipeline:
>>         <map:match pattern="*-pipeline.xsp">
>>                <map:generate type="jx" src="forms/{1}.xml"/>
>>                <map:serialize type="xml"/>
>>              </map:match>
>>          
>>         the jx generator creates a cForm xml model in correct syntax
>>         and is outputted as XML to the browser...
>>          
>>         what im trying to do now is feed this newly generated xml
>>         model to the pipeline so that a Form will be generated and
>>         viewed, however i'm not really sure how to do this, or which
>>         part of cocoon docos i sould be reading...
>>         How do I dynamically generate input content to be used as a
>>         source in the sitemap??
>>          
>>          
>>         Any help would be appreciated...
>>
>>          
>>
>>
>>
>>
>>     -- 
>>     Bart Remmerie 
>>
>>
> 
> 
> -- 
> Philippe Gauthier
> INSERM
> DRH - SIRH
> Tel: 01.44.23.62.57
> 


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


Re: dynamic cForm generation

Posted by Philippe Gauthier - INSERM SIRH <ph...@tolbiac.inserm.fr>.
Hi Rashel,

U shouldn't use a dynamic form definition, because it means for each 
call, cocoon will have to compile a new form and can't use any caching.
I did the same mistake using xslt transformation to generate the 
definition (using pipelineToStream to save it to disk temporary) and it 
killed the JVM eventually .
And that's why the form instantiation function takes only system file.

Instead u have to understand the binding concepts of forms an redesign a 
or some generic forms definition and templates with more complex widgets.
Then u'll be have able to fill thoses forms with dynamic data.
I hope I gave U the right pointers, sorry for my english.

regards,

Philippe

Rashel Shehata a écrit :
> Hi Bart,
> Ok so  to create the form definition xml the jx generator uses the 
> following xml file:
> I pass it an array object (questionRegistry.getAllQuestions()) that 
> contains a list of all the questions to be created in the form
>
> <?xml version="1.0"?>
> <fd:form xmlns:fd="http://apache.org/cocoon/forms/1.0#definition"
>          xmlns:i18n=" http://apache.org/cocoon/i18n/2.1"
>     xmlns:jx="http://apache.org/cocoon/templates/jx/1.0">
>
>
> <fd:widgets>
>   
>    <jx:forEach var="question" items="${questions}">
>   
>    <jx:choose>
>  <jx:when test="${question.responseType == 'multivalue-field'}">
>   <fd:multivaluefield id='${question.ID}' 
> required='${question.required}' state='${question.state}'>
>     <fd:label>     ${question.label} </fd:label>
>     <fd:help>${ question.help}</fd:help>
>        <fd:hint>${question.hint}</fd:hint>
>      <fd:datatype base="long"></fd:datatype>
>      <fd:selection-list>
>      <jx:forEach var="response" items="${ question.responses}">
>      <fd:item value='${response.ID}'>
>         <fd:label>${response.label}</fd:label>
>         </fd:item>
>   
>    </jx:forEach>
>    </fd:selection-list>
>   </fd:multivaluefield>
>   
>   </jx:when>
>  
>   <jx:when test="${question.responseType == 'checkbox'}">
>   <fd:booleanfield id='${question.ID}' required='${ 
> question.required}' state='${question.state}'>
>     <fd:label>     ${question.label} </fd:label>
>     <fd:help>${question.help}</fd:help>
>        <fd:hint>${question.hint }</fd:hint>
>    </fd:booleanfield>
>
>   </jx:when>
>
>  <jx:otherwise>
>    <fd:field id='${question.ID}' required='${question.required}' 
> state='${question.state}'>
>        <fd:label>     ${question.label} ${question.responseType } 
> </fd:label>
>     <fd:help>${question.help}</fd:help>
>        <fd:hint>${question.hint}</fd:hint>
>
> ...
>
>   </fd:field>
>  </jx:otherwise>  
>    </jx:choose>
>    </jx:forEach>
>  </fd:widgets>
>  </fd:form>
>  
>
>  
>
> the jx generator then outputs the serialized xml to the browser, where 
> the xml is in correct cForm syntax... it's similar for the 
> form template also...
>
> I now want to do use both serialized xml and feed it back into a  
> pipeline entry so i can view the generated form as a HTML form...
>
>  
>
> I hope this made my problem clearer..
>
>  
>
> Thanks heaps
>
> On 4/18/07, *bart remmerie* <remmerie@gmail.com 
> <ma...@gmail.com>> wrote:
>
>     Dear Rashel,
>
>     Could you give an example/snippet of one of these .xml files ?
>
>     Bart
>
>     2007/4/18, Rashel Shehata <rashel.s@gmail.com
>     <ma...@gmail.com>>:
>
>         Hey,
>          
>         I'm trying to generate cocoon forms dynamically. atm I create
>         the cForm model xml dynamically using jx generator; this is
>         what i have:
>          
>         in my flowscript:
>           cocoon.sendPage("form_model-pipeline.xsp" ,
>              {questions: questionRegistry.getAllQuestions()});
>          
>         and in my pipeline:
>         <map:match pattern="*-pipeline.xsp">
>                <map:generate type="jx" src="forms/{1}.xml"/>
>                <map:serialize type="xml"/>
>              </map:match>
>          
>         the jx generator creates a cForm xml model in correct syntax
>         and is outputted as XML to the browser...
>          
>         what im trying to do now is feed this newly generated xml
>         model to the pipeline so that a Form will be generated and
>         viewed, however i'm not really sure how to do this, or which
>         part of cocoon docos i sould be reading...
>         How do I dynamically generate input content to be used as a
>         source in the sitemap??
>          
>          
>         Any help would be appreciated...
>
>          
>
>
>
>
>     -- 
>     Bart Remmerie 
>
>


-- 
Philippe Gauthier
INSERM
DRH - SIRH
Tel: 01.44.23.62.57


Re: dynamic cForm generation

Posted by Rashel Shehata <ra...@gmail.com>.
Hi Bart,
Ok so  to create the form definition xml the jx generator uses the following
xml file:
I pass it an array object (questionRegistry.getAllQuestions()) that contains
a list of all the questions to be created in the form

<?xml version="1.0"?>
<fd:form xmlns:fd="http://apache.org/cocoon/forms/1.0#definition"
         xmlns:i18n="http://apache.org/cocoon/i18n/2.1"
    xmlns:jx="http://apache.org/cocoon/templates/jx/1.0">


<fd:widgets>

   <jx:forEach var="question" items="${questions}">

   <jx:choose>
 <jx:when test="${question.responseType == 'multivalue-field'}">
  <fd:multivaluefield id='${question.ID}' required='${question.required}'
state='${question.state}'>
    <fd:label>     ${question.label} </fd:label>
    <fd:help>${question.help}</fd:help>
       <fd:hint>${question.hint}</fd:hint>
     <fd:datatype base="long"></fd:datatype>
     <fd:selection-list>
     <jx:forEach var="response" items="${question.responses}">
     <fd:item value='${response.ID}'>
        <fd:label>${response.label}</fd:label>
        </fd:item>

   </jx:forEach>
   </fd:selection-list>
  </fd:multivaluefield>

  </jx:when>

  <jx:when test="${question.responseType == 'checkbox'}">
  <fd:booleanfield id='${question.ID}' required='${question.required}'
state='${question.state}'>
    <fd:label>     ${question.label} </fd:label>
    <fd:help>${question.help}</fd:help>
       <fd:hint>${question.hint}</fd:hint>
   </fd:booleanfield>

  </jx:when>

 <jx:otherwise>
   <fd:field id='${question.ID}' required='${question.required}' state='${
question.state}'>
       <fd:label>     ${question.label} ${question.responseType} </fd:label>
    <fd:help>${question.help}</fd:help>
       <fd:hint>${question.hint}</fd:hint>

...

  </fd:field>
 </jx:otherwise>
   </jx:choose>
   </jx:forEach>
 </fd:widgets>
 </fd:form>




the jx generator then outputs the serialized xml to the browser, where the
xml is in correct cForm syntax... it's similar for the form template also...

I now want to do use both serialized xml and feed it back into a  pipeline
entry so i can view the generated form as a HTML form...



I hope this made my problem clearer..



Thanks heaps
On 4/18/07, bart remmerie <re...@gmail.com> wrote:
>
> Dear Rashel,
>
> Could you give an example/snippet of one of these .xml files ?
>
> Bart
>
> 2007/4/18, Rashel Shehata <ra...@gmail.com>:
> >
> > Hey,
> >
> > I'm trying to generate cocoon forms dynamically. atm I create the cForm
> > model xml dynamically using jx generator; this is what i have:
> >
> > in my flowscript:
> >   cocoon.sendPage("form_model-pipeline.xsp" ,
> >      {questions: questionRegistry.getAllQuestions()});
> >
> > and in my pipeline:
> > <map:match pattern="*-pipeline.xsp">
> >        <map:generate type="jx" src="forms/{1}.xml"/>
> >        <map:serialize type="xml"/>
> >      </map:match>
> >
> > the jx generator creates a cForm xml model in correct syntax and is
> > outputted as XML to the browser...
> >
> > what im trying to do now is feed this newly generated xml model to the
> > pipeline so that a Form will be generated and viewed, however i'm not really
> > sure how to do this, or which part of cocoon docos i sould be reading...
> > How do I dynamically generate input content to be used as a source in
> > the sitemap??
> >
> >
> > Any help would be appreciated...
> >
> >
> >
>
>
>
> --
> Bart Remmerie

Re: dynamic cForm generation

Posted by bart remmerie <re...@gmail.com>.
Dear Rashel,

Could you give an example/snippet of one of these .xml files ?

Bart

2007/4/18, Rashel Shehata <ra...@gmail.com>:
>
> Hey,
>
> I'm trying to generate cocoon forms dynamically. atm I create the cForm
> model xml dynamically using jx generator; this is what i have:
>
> in my flowscript:
>   cocoon.sendPage("form_model-pipeline.xsp" ,
>      {questions: questionRegistry.getAllQuestions()});
>
> and in my pipeline:
> <map:match pattern="*-pipeline.xsp">
>        <map:generate type="jx" src="forms/{1}.xml"/>
>        <map:serialize type="xml"/>
>      </map:match>
>
> the jx generator creates a cForm xml model in correct syntax and is
> outputted as XML to the browser...
>
> what im trying to do now is feed this newly generated xml model to the
> pipeline so that a Form will be generated and viewed, however i'm not really
> sure how to do this, or which part of cocoon docos i sould be reading...
> How do I dynamically generate input content to be used as a source in the
> sitemap??
>
>
> Any help would be appreciated...
>
>
>



-- 
Bart Remmerie