How to generate the form dynamically?

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

How to generate the form dynamically?

SidKennedy
Hello,
I started playing around with Orbeon Forms. Today I was successful in generating a model with a Java servlet. Now I'm wondering if it is possible to generate the form with a servlet as well? I'm asking because my models can be of an arbitrary structure (or meta-model) and I'd love to add some rendering-information to my model-elements and generate the form dynamically. Is that possible?

best regards
Sid
Reply | Threaded
Open this post in threaded view
|

Re: How to generate the form dynamically?

Erik Bruchez
Administrator
Sid,

> I started playing around with Orbeon Forms. Today I was successful in
> generating a model with a Java servlet. Now I'm wondering if it is  
> possible
> to generate the form with a servlet as well? I'm asking because my  
> models
> can be of an arbitrary structure (or meta-model) and I'd love to add  
> some
> rendering-information to my model-elements and generate the form
> dynamically. Is that possible?

Yes, you can generate the entire form with a servlet. One way is to  
follow instructions here:

   http://www.orbeon.com/ops/doc/reference-xforms-java

-Erik

--
Orbeon Forms - Web Forms for the Enterprise Done the Right Way
http://www.orbeon.com/



--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: How to generate the form dynamically?

SidKennedy
Erik I followed your link. That's the document whith which I got generating a model with a servlet done. But I don't understand how your link helps me with generating the form? can you give me a hint?
I mean to get the model it is sufficient calling this:

<xforms:submission id="do-query" method="get" replace="instance" instance="photos" resource="/XmlProducer"/>

and XmlProducer is the servlet. But how can I specify within

<xhtml:div class="myGeneratedForm">
....
</xhtml:div>

that the structure should come from a servlet as well?
Hope you understand me.
Reply | Threaded
Open this post in threaded view
|

Re: How to generate the form dynamically?

Alessandro Vernet
Administrator
SidKennedy wrote
I mean to get the model it is sufficient calling this:

<xforms:submission id="do-query" method="get" replace="instance" instance="photos" resource="/XmlProducer"/>

and XmlProducer is the servlet.
That is correct.

SidKennedy wrote
But how can I specify within

<xhtml:div class="myGeneratedForm">
....
</xhtml:div>

that the structure should come from a servlet as well?
let me try to understand this. What do you mean by "structure coming from a servlet"? The structure of what? How is it related to the <xhtml:div>?

Alex
Reply | Threaded
Open this post in threaded view
|

Re: How to generate the form dynamically?

SidKennedy

Alessandro Vernet wrote
let me try to understand this. What do you mean by "structure coming from a servlet"? The structure of what? How is it related to the <xhtml:div>?
The structure of the visible form at the end. I want a Java-class to generate not only the xml-data but the form as well. I took my second code-snippet from the examples - within <xhtml:div> they put the form. And as far as I read until now, I've never seen a snippet in which the form is genereated by an "external" (servlet or something), that means outside the xhtml-file.
Reply | Threaded
Open this post in threaded view
|

Re: How to generate the form dynamically?

Alessandro Vernet
Administrator
SidKennedy wrote
The structure of the visible form at the end. I want a Java-class to generate not only the xml-data but the form as well. I took my second code-snippet from the examples - within <xhtml:div> they put the form. And as far as I read until now, I've never seen a snippet in which the form is genereated by an "external" (servlet or something), that means outside the xhtml-file.
I see. Then no, you won't get the form with an <xforms:submission>. You will generate the XForms from your servlet, as if you were sending that XForms to the browser. Then you setup the web.xml to have the output of your servlet processed by the orbeon-xforms-filter before it is sent to the browser. (This is what Erik already mentioned earlier in this thread.)

Your servlet can generate the form that already contains the instance with the dynamic data, or it can just generate a form (with an empty instance), and you'll get the actual instance from another servlet using an <xforms:submission>. Does this help?

Alex
Reply | Threaded
Open this post in threaded view
|

Re: How to generate the form dynamically?

SidKennedy

Alessandro Vernet wrote
I see. Then no, you won't get the form with an <xforms:submission>. You will generate the XForms from your servlet, as if you were sending that XForms to the browser. Then you setup the web.xml to have the output of your servlet processed by the orbeon-xforms-filter before it is sent to the browser. (This is what Erik already mentioned earlier in this thread.)

Your servlet can generate the form that already contains the instance with the dynamic data, or it can just generate a form (with an empty instance), and you'll get the actual instance from another servlet using an <xforms:submission>. Does this help?

Alex
Ah ok - I think I understand now :) You mean not to provide a xhtml-page but generate the stream with a servlet which sends it directly to the browser. I was stuck in thinking that a xhtml is necessary. I'll try it and give feedback.
Reply | Threaded
Open this post in threaded view
|

Re: How to generate the form dynamically?

SidKennedy
In reply to this post by SidKennedy
Ok I got it now. Thank you very much for pushing me into the right direction and sorry for my not so opened mind ;)