How to create form controls dynamically

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

How to create form controls dynamically

venkatesh Giriyappa
Hi,
I am using xforms orbeon framework. I have a configuration xml file which is defined with all the UI controls. How do I create UI form controls dynamically, by referring this configuration XML document.
 
Thanks,
Venkatesh

Send free SMS to your Friends on Mobile from your Yahoo! Messenger. Download Now! http://messenger.yahoo.com/download.php

--
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 create form controls dynamically

fl.schmitt(ops-users)
venkatesh,

> I am using xforms orbeon framework. I have a configuration xml file
> which is defined with all the UI controls. How do I create UI form
> controls dynamically, by referring this configuration XML document.

you could use a xpl pipeline to create a xforms view. Inside that
pipeline, you can use the XSLT processor to create a xhtml output with
xforms controls based on your config file. It's important that the
pipeline has a data output for the xhtml.

I've attached a simple example with some "configuration" xml data
enclosed. If you put it under
webapps/<yourapp>/WEB-INF/resources/pages/test/dynamiccontrols.xpl, you
just have to add a page-flow entry like this:

<page id="dyn"
    path-info="/dyn"
    view="pages/test/dynamiccontrols.xpl"/>

Then it should be available under

http://localhost:8080/<yourwebbapp>/dyn

The xpl creates a xhtml+xforms page based on the data input. It takes
the data input as instance as it is, and inserts a xforms:input control
for each instance element under /document.

HTH
florian


--
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: Re: How to create form controls dynamically

fl.schmitt(ops-users)
sorry, forgot to attach the sample... :-|

> I've attached a simple example with some "configuration" xml data
> enclosed. ...

florian



<p:config xmlns:p="http://www.orbeon.com/oxf/pipeline"
        xmlns:saxon="http://saxon.sf.net/" xmlns:oxf="http://www.orbeon.com/oxf/processors"
        xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

        <p:param type="output" name="data" />

        <p:processor name="oxf:xslt">
                <p:input name="config">
                        <xsl:stylesheet version="2.0">
                                <xsl:template match="/">
                                        <html xmlns="http://www.w3.org/1999/xhtml" xmlns:xforms="http://www.w3.org/2002/xforms"
                                                xmlns:xxforms="http://orbeon.org/oxf/xml/xforms">
                                                <head>
                                                        <title>DynControls</title>
                                                        <xforms:model>
                                                                <xforms:instance>
                                                                        <xsl:copy-of select="/" />
                                                                </xforms:instance>
                                                        </xforms:model>
                                                </head>
                                                <body>
                                                        <h1>Test</h1>
                                                        <xsl:for-each select="/document/*">
                                                                <xsl:element name="xforms:input" >
                                                                        <xsl:attribute name="ref">
                                                                                <xsl:value-of select="name()" />
                                                                        </xsl:attribute>
                                                                        <xforms:label><xsl:value-of select="./@id" />: </xforms:label>
                                                                </xsl:element>
                                                                <p />
                                                        </xsl:for-each>
                                                        <widget:xforms-instance-inspector xmlns:widget="http://orbeon.org/oxf/xml/widget"/>
                                                </body>
                                        </html>
                                </xsl:template>
                        </xsl:stylesheet>
                </p:input>
                <p:input name="data">
                        <document>
                                <foo id="1">bar1</foo>
                                <bar id="2">bar2</bar>
                                <bee id="3">bar3</bee>
                        </document>
                </p:input>
                <p:output name="data" ref="data" debug="data" />
        </p:processor>

</p:config>

--
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: Re: Re: How to create form controls dynamically

manish_suriya

Hi,


I Put the file in C:\Tools\apache-tomcat-5.5.17\webapps\orbeon\WEB-INF\resources\apps\dyn  folder where my orbeon is deployed.

this dyn folder contains two files: page-flow.xpl and dynamiccontrols.xpl

page-flow.xml looks as:
===================
--
<config xmlns="http://www.orbeon.com/oxf/controller">

    <page id="dyn"
    path-info="/dyn"
    view="dynamiccontrols.xpl"/>

    <epilogue url="oxf:/config/epilogue.xpl"/>

</config>


and dynamiccontrols.xpl what you provided.

Apart from this, Are some more supporting files it require ? As i am getting error:

Condition failed for every branch of choose: [(/request/request-path = '/xforms-server-submit'), (/request/request-path = '/dyn')]


Can you provide me the full working example with supporting file. I am not able to run this.

thanks in advance !!

Thanks
Manish Suriya
Mailto: [hidden email]
Website:
http://www.tcs.com
____________________________________________
Experience certainty.        IT Services
                       Business Solutions
                       Outsourcing
____________________________________________



Florian Schmitt <[hidden email]>

10/20/2008 08:38 PM

Please respond to
[hidden email]

To
[hidden email]
cc
Subject
[ops-users] Re: Re: How to create form controls dynamically





sorry, forgot to attach the sample... :-|

> I've attached a simple example with some "configuration" xml data
> enclosed. ...

florian


<p:config xmlns:p="
http://www.orbeon.com/oxf/pipeline"
                xmlns:saxon="
http://saxon.sf.net/" xmlns:oxf="http://www.orbeon.com/oxf/processors"
                xmlns:xsl="
http://www.w3.org/1999/XSL/Transform">

                <p:param type="output" name="data" />

                <p:processor name="oxf:xslt">
                                 <p:input name="config">
                                                  <xsl:stylesheet version="2.0">
                                                                   <xsl:template match="/">
                                                                                    <html xmlns="
http://www.w3.org/1999/xhtml" xmlns:xforms="http://www.w3.org/2002/xforms"
                                                                                                     xmlns:xxforms="
http://orbeon.org/oxf/xml/xforms">
                                                                                                     <head>
                                                                                                                      <title>DynControls</title>
                                                                                                                      <xforms:model>
                                                                                                                                       <xforms:instance>
                                                                                                                                                        <xsl:copy-of select="/" />
                                                                                                                                       </xforms:instance>
                                                                                                                      </xforms:model>
                                                                                                     </head>
                                                                                                     <body>
                                                                                                                      <h1>Test</h1>
                                                                                                                      <xsl:for-each select="/document/*">
                                                                                                                                       <xsl:element name="xforms:input" >
                                                                                                                                                        <xsl:attribute name="ref">
                                                                                                                                                                         <xsl:value-of select="name()" />
                                                                                                                                                        </xsl:attribute>
                                                                                                                                                        <xforms:label><xsl:value-of select="./@id" />: </xforms:label>
                                                                                                                                       </xsl:element>
                                                                                                                                       <p />
                                                                                                                      </xsl:for-each>
                                                                                                                      <widget:xforms-instance-inspector xmlns:widget="
http://orbeon.org/oxf/xml/widget"/>
                                                                                                     </body>
                                                                                    </html>
                                                                   </xsl:template>
                                                  </xsl:stylesheet>
                                 </p:input>
                                 <p:input name="data">
                                                  <document>
                                                                   <foo id="1">bar1</foo>
                                                                   <bar id="2">bar2</bar>
                                                                   <bee id="3">bar3</bee>
                                                  </document>
                                 </p:input>
                                 <p:output name="data" ref="data" debug="data" />
                </p:processor>

</p:config>
--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe:
[hidden email]
For general help:
[hidden email]
OW2 mailing lists service home page:
http://www.ow2.org/wws

ForwardSourceID:NT00011016    
=====-----=====-----=====
Notice: The information contained in this e-mail
message and/or attachments to it may contain 
confidential or privileged information. If you are 
not the intended recipient, any dissemination, use, 
review, distribution, printing or copying of the 
information contained in this e-mail message 
and/or attachments to it are strictly prohibited. If 
you have received this communication in error, 
please notify us by reply e-mail or telephone and 
immediately and permanently delete the message 
and any attachments. Thank you




--
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: Re: Re: Re: How to create form controls dynamically

fl.schmitt(ops-users)
Manish,

> Can you provide me the full working example with supporting file. I am
> not able to run this.

sorry, was indeed too specific - i've attached a zip containing the xpl
and a modified page-flow. Just unzip it in the apps directory of your
orbeon webapp. Then it should work with
http://localhost:8080/orbeon/dyn/

florian


--
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

dyn.zip (1K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Re: Re: Re: Re: How to create form controls dynamically

manish_suriya

Thanks a lot !!!

Manish Suriya
Mailto: [hidden email]
Website:
http://www.tcs.com
____________________________________________
Experience certainty.        IT Services
                       Business Solutions
                       Outsourcing
____________________________________________



Florian Schmitt <[hidden email]>

10/22/2008 09:07 PM

Please respond to
[hidden email]

To
[hidden email]
cc
Subject
[ops-users] Re: Re: Re: Re: How to create form controls dynamically





Manish,

> Can you provide me the full working example with supporting file. I am
> not able to run this.

sorry, was indeed too specific - i've attached a zip containing the xpl
and a modified page-flow. Just unzip it in the apps directory of your
orbeon webapp. Then it should work with
http://localhost:8080/orbeon/dyn/

florian

--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe:
[hidden email]
For general help:
[hidden email]
OW2 mailing lists service home page:
http://www.ow2.org/wws

ForwardSourceID:NT0001110A    
=====-----=====-----=====
Notice: The information contained in this e-mail
message and/or attachments to it may contain 
confidential or privileged information. If you are 
not the intended recipient, any dissemination, use, 
review, distribution, printing or copying of the 
information contained in this e-mail message 
and/or attachments to it are strictly prohibited. If 
you have received this communication in error, 
please notify us by reply e-mail or telephone and 
immediately and permanently delete the message 
and any attachments. Thank you




--
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

dyn.zip (1K) Download Attachment