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 <[EMAIL PROTECTED]> wrote:

Dear Rashel,

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

Bart

2007/4/18, Rashel Shehata <[EMAIL PROTECTED]>:
>
> 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

Reply via email to