Most effective way to dynamically load a form

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

Most effective way to dynamically load a form

Ethan Gruber
Hi all,

I'm working on a project that leverages Orbeon for editing data and cocoon for actually rendering it.  My cocoon app has an admin section which displays a table of all the XML files available to be edited with links to the orbeon app.  I want to be able to load that file automatically when the page loads, or at least put the unique identifier from cocoon passed through a parameter into the text input for the XML document id and have it validate.

As an example, here is my submission code for loading a document:

<!-- Load File -->
<xf:submission id="list-submission" serialization="none" method="get" action="/exist/rest/db/ead/{//c/@id}.xml" replace="instance" instance="guide"/>

The related input is this:

<div>
  <xf:input ref="@id" class="doc_id">
  <xf:label>Document ID</xf:label>
  <xf:alert>The doc id is required</xf:alert>
  </xf:input>
</div>

The way my form functions now, I can type 'abc123' into the doc ID input, click the 'open' link, and it will load abc123.xml from exist.  I wrote a simple jquery script that parses the parameters and writes parameter 'id' into that text input.  The thing is, Orbeon won't validate it unless the string is put there by a person.  You can't insert text with javascript and have it validate properly it seems.

I hope it is understood what I'm trying to do.  I'm just trying to figure out the best way to load a file when transitioning from one tomcat application to another.

One other thing--I would like to have automatic indexing of updated data from Orbeon into a solr index.  Is it possible, when submitting the form, to initialize a task that transforms that XML against a stylesheet into a form that solr can interpret and send it to the index through curl?

Thanks,
Ethan


--
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: Most effective way to dynamically load a form

Erik Bruchez-3
Ethan,

If page A wants to tell page B to load form "foobar", I would simply
put "foobar" on the URL which loads page B, whether as part of the
path or as a URL parameter. Then you can, in XForms, load the proper
XML document from the database, using e.g.
xxforms:get-request-parameter().

If you want to use JavaScript, then try the setValue() method from our JS API:

http://wiki.orbeon.com/forms/doc/developer-guide/xforms-extensions#TOC-JavaScript-Integration

-Erik

On Wed, Aug 12, 2009 at 10:56 AM, Ethan Gruber<[hidden email]> wrote:

> Hi all,
>
> I'm working on a project that leverages Orbeon for editing data and cocoon
> for actually rendering it.  My cocoon app has an admin section which
> displays a table of all the XML files available to be edited with links to
> the orbeon app.  I want to be able to load that file automatically when the
> page loads, or at least put the unique identifier from cocoon passed through
> a parameter into the text input for the XML document id and have it
> validate.
>
> As an example, here is my submission code for loading a document:
>
> <!-- Load File -->
> <xf:submission id="list-submission" serialization="none" method="get"
> action="/exist/rest/db/ead/{//c/@id}.xml" replace="instance"
> instance="guide"/>
>
> The related input is this:
>
> <div>
>   <xf:input ref="@id" class="doc_id">
>   <xf:label>Document ID</xf:label>
>   <xf:alert>The doc id is required</xf:alert>
>   </xf:input>
> </div>
>
> The way my form functions now, I can type 'abc123' into the doc ID input,
> click the 'open' link, and it will load abc123.xml from exist.  I wrote a
> simple jquery script that parses the parameters and writes parameter 'id'
> into that text input.  The thing is, Orbeon won't validate it unless the
> string is put there by a person.  You can't insert text with javascript and
> have it validate properly it seems.
>
> I hope it is understood what I'm trying to do.  I'm just trying to figure
> out the best way to load a file when transitioning from one tomcat
> application to another.
>
> One other thing--I would like to have automatic indexing of updated data
> from Orbeon into a solr index.  Is it possible, when submitting the form, to
> initialize a task that transforms that XML against a stylesheet into a form
> that solr can interpret and send it to the index through curl?
>
> Thanks,
> Ethan
>
>
> --
> 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
>
>


--
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: Most effective way to dynamically load a form

Ethan Gruber
Thanks!

It works.  I found this blog article that illustrates the issue very nicely

http://blog.msbbc.co.uk/2008/05/orbeon-inline-xslt-and-get-parameters.html

Ethan

On Wed, Aug 12, 2009 at 2:03 AM, Erik Bruchez <[hidden email]> wrote:
Ethan,

If page A wants to tell page B to load form "foobar", I would simply
put "foobar" on the URL which loads page B, whether as part of the
path or as a URL parameter. Then you can, in XForms, load the proper
XML document from the database, using e.g.
xxforms:get-request-parameter().

If you want to use JavaScript, then try the setValue() method from our JS API:

http://wiki.orbeon.com/forms/doc/developer-guide/xforms-extensions#TOC-JavaScript-Integration

-Erik

On Wed, Aug 12, 2009 at 10:56 AM, Ethan Gruber<[hidden email]> wrote:
> Hi all,
>
> I'm working on a project that leverages Orbeon for editing data and cocoon
> for actually rendering it.  My cocoon app has an admin section which
> displays a table of all the XML files available to be edited with links to
> the orbeon app.  I want to be able to load that file automatically when the
> page loads, or at least put the unique identifier from cocoon passed through
> a parameter into the text input for the XML document id and have it
> validate.
>
> As an example, here is my submission code for loading a document:
>
> <!-- Load File -->
> <xf:submission id="list-submission" serialization="none" method="get"
> action="/exist/rest/db/ead/{//c/@id}.xml" replace="instance"
> instance="guide"/>
>
> The related input is this:
>
> <div>
>   <xf:input ref="@id" class="doc_id">
>   <xf:label>Document ID</xf:label>
>   <xf:alert>The doc id is required</xf:alert>
>   </xf:input>
> </div>
>
> The way my form functions now, I can type 'abc123' into the doc ID input,
> click the 'open' link, and it will load abc123.xml from exist.  I wrote a
> simple jquery script that parses the parameters and writes parameter 'id'
> into that text input.  The thing is, Orbeon won't validate it unless the
> string is put there by a person.  You can't insert text with javascript and
> have it validate properly it seems.
>
> I hope it is understood what I'm trying to do.  I'm just trying to figure
> out the best way to load a file when transitioning from one tomcat
> application to another.
>
> One other thing--I would like to have automatic indexing of updated data
> from Orbeon into a solr index.  Is it possible, when submitting the form, to
> initialize a task that transforms that XML against a stylesheet into a form
> that solr can interpret and send it to the index through curl?
>
> Thanks,
> Ethan
>
>
> --
> 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
>
>


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




--
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: Most effective way to dynamically load a form

Ethan Gruber
Hi,

I have a followup to this question.  It's probably very simple, but I haven't found it documented in archive.

I am able to load a URL parameter into an 'id' input.  Once the value of the parameter has been placed into the input, I can click on the xforms:submit button to load 'id'.xml.  What I want to do is eliminate this intermediary step.  How can I make 'id'.xml open when the page/form itself loads without it being necessary for the user to click on a link?

Thanks,
Ethan

On Wed, Aug 12, 2009 at 11:37 PM, Ethan Gruber <[hidden email]> wrote:
Thanks!

It works.  I found this blog article that illustrates the issue very nicely

http://blog.msbbc.co.uk/2008/05/orbeon-inline-xslt-and-get-parameters.html

Ethan


On Wed, Aug 12, 2009 at 2:03 AM, Erik Bruchez <[hidden email]> wrote:
Ethan,

If page A wants to tell page B to load form "foobar", I would simply
put "foobar" on the URL which loads page B, whether as part of the
path or as a URL parameter. Then you can, in XForms, load the proper
XML document from the database, using e.g.
xxforms:get-request-parameter().

If you want to use JavaScript, then try the setValue() method from our JS API:

http://wiki.orbeon.com/forms/doc/developer-guide/xforms-extensions#TOC-JavaScript-Integration

-Erik

On Wed, Aug 12, 2009 at 10:56 AM, Ethan Gruber<[hidden email]> wrote:
> Hi all,
>
> I'm working on a project that leverages Orbeon for editing data and cocoon
> for actually rendering it.  My cocoon app has an admin section which
> displays a table of all the XML files available to be edited with links to
> the orbeon app.  I want to be able to load that file automatically when the
> page loads, or at least put the unique identifier from cocoon passed through
> a parameter into the text input for the XML document id and have it
> validate.
>
> As an example, here is my submission code for loading a document:
>
> <!-- Load File -->
> <xf:submission id="list-submission" serialization="none" method="get"
> action="/exist/rest/db/ead/{//c/@id}.xml" replace="instance"
> instance="guide"/>
>
> The related input is this:
>
> <div>
>   <xf:input ref="@id" class="doc_id">
>   <xf:label>Document ID</xf:label>
>   <xf:alert>The doc id is required</xf:alert>
>   </xf:input>
> </div>
>
> The way my form functions now, I can type 'abc123' into the doc ID input,
> click the 'open' link, and it will load abc123.xml from exist.  I wrote a
> simple jquery script that parses the parameters and writes parameter 'id'
> into that text input.  The thing is, Orbeon won't validate it unless the
> string is put there by a person.  You can't insert text with javascript and
> have it validate properly it seems.
>
> I hope it is understood what I'm trying to do.  I'm just trying to figure
> out the best way to load a file when transitioning from one tomcat
> application to another.
>
> One other thing--I would like to have automatic indexing of updated data
> from Orbeon into a solr index.  Is it possible, when submitting the form, to
> initialize a task that transforms that XML against a stylesheet into a form
> that solr can interpret and send it to the index through curl?
>
> Thanks,
> Ethan
>
>
> --
> 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
>
>


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





--
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: Most effective way to dynamically load a form

Alessandro  Vernet
Administrator
Ethan,

On Thu, Nov 12, 2009 at 6:42 AM, Ethan Gruber <[hidden email]> wrote:
> I am able to load a URL parameter into an 'id' input.  Once the value of the
> parameter has been placed into the input, I can click on the xforms:submit
> button to load 'id'.xml.  What I want to do is eliminate this intermediary
> step.  How can I make 'id'.xml open when the page/form itself loads without
> it being necessary for the user to click on a link?

What do you mean by "opening 'id'.xml"? Are you loading that file into
an instance? Or loading that file in the browser (a sort of
redirection)?

Alex
--
Orbeon Forms - Web forms, open-source, for the Enterprise
Orbeon's Blog: http://www.orbeon.com/blog/
My Twitter: http://twitter.com/avernet


--
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
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
Reply | Threaded
Open this post in threaded view
|

Re: Re: Re: Re: Most effective way to dynamically load a form

Ethan Gruber
Hi Alex,

I am using

<xf:action ev:event="xforms-model-construct-done">
                <xf:setvalue ref="instance('guide')/@id" value="xxforms:get-request-parameter('id')"
                />
</xf:action>

to insert the URL parameter into the @id for the main instance.  Then my submission is as follows:

<xf:submission id="list-submission" serialization="none" method="get"
                action="/exist/rest/db/projectname/{instance('guide')/@id}.xml" replace="instance" instance="guide">
                <xf:message ev:event="xforms-submit-error" level="modal">Load Error!</xf:message>
</xf:submission>

The submission loads the the xml file that matches the URL parameter passed into the form.  Right now, the user has to click on an xforms:submit link in order to open the file from eXist, similar to the xforms-bookcast example.  I would like to load the XML file from eXist without having to click a button.

Thanks for your help!
Ethan

On Thu, Nov 12, 2009 at 8:41 PM, Alessandro Vernet <[hidden email]> wrote:
Ethan,

On Thu, Nov 12, 2009 at 6:42 AM, Ethan Gruber <[hidden email]> wrote:
> I am able to load a URL parameter into an 'id' input.  Once the value of the
> parameter has been placed into the input, I can click on the xforms:submit
> button to load 'id'.xml.  What I want to do is eliminate this intermediary
> step.  How can I make 'id'.xml open when the page/form itself loads without
> it being necessary for the user to click on a link?

What do you mean by "opening 'id'.xml"? Are you loading that file into
an instance? Or loading that file in the browser (a sort of
redirection)?

Alex
--
Orbeon Forms - Web forms, open-source, for the Enterprise
Orbeon's Blog: http://www.orbeon.com/blog/
My Twitter: http://twitter.com/avernet


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




--
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: Re: Most effective way to dynamically load a form

Alessandro  Vernet
Administrator
Ethan,

On Fri, Nov 13, 2009 at 7:42 AM, Ethan Gruber <[hidden email]> wrote:
> The submission loads the the xml file that matches the URL parameter passed
> into the form.  Right now, the user has to click on an xforms:submit link in
> order to open the file from eXist, similar to the xforms-bookcast example.
> I would like to load the XML file from eXist without having to click a
> button.

So you want the "form" to load in the browser the XML from eXist right
away. So the form wouldn't really be displayed, it would right away do
a redirect to the XML. You can do this by having:

<xforms:load ev:event="xforms-model-construct-done"
     resource="/exist/rest/db/projectname/{xxforms:get-request-parameter('id')}"/>

Orbeon Forms is smart enough to detect that, and will issue a redirect
to the browser, which will go to the page you mentioned right away.

Alex
--
Orbeon Forms - Web forms, open-source, for the Enterprise
Orbeon's Blog: http://www.orbeon.com/blog/
My Twitter: http://twitter.com/avernet


--
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
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
Reply | Threaded
Open this post in threaded view
|

Re: Re: Re: Re: Re: Re: Most effective way to dynamically load a form

Ethan Gruber
Sorry for the confusion.

What I want to do is load {xxforms:get-request-parameter('id')}.xml into the form automatically (on ev:event="xforms-model-construct-done").  I can't figure out the syntax.  I don't want to redirect to the XML file in eXist itself, but load that file into the form.

Thanks,
Ethan

On Fri, Nov 13, 2009 at 7:56 PM, Alessandro Vernet <[hidden email]> wrote:
Ethan,

On Fri, Nov 13, 2009 at 7:42 AM, Ethan Gruber <[hidden email]> wrote:
> The submission loads the the xml file that matches the URL parameter passed
> into the form.  Right now, the user has to click on an xforms:submit link in
> order to open the file from eXist, similar to the xforms-bookcast example.
> I would like to load the XML file from eXist without having to click a
> button.

So you want the "form" to load in the browser the XML from eXist right
away. So the form wouldn't really be displayed, it would right away do
a redirect to the XML. You can do this by having:

<xforms:load ev:event="xforms-model-construct-done"
    resource="/exist/rest/db/projectname/{xxforms:get-request-parameter('id')}"/>

Orbeon Forms is smart enough to detect that, and will issue a redirect
to the browser, which will go to the page you mentioned right away.

Alex
--
Orbeon Forms - Web forms, open-source, for the Enterprise
Orbeon's Blog: http://www.orbeon.com/blog/
My Twitter: http://twitter.com/avernet


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




--
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: Re: Re: Re: Most effective way to dynamically load a form

Alessandro  Vernet
Administrator
Ethan,

On Mon, Nov 16, 2009 at 6:55 AM, Ethan Gruber <[hidden email]> wrote:
> Sorry for the confusion.
>
> What I want to do is load {xxforms:get-request-parameter('id')}.xml into the
> form automatically (on ev:event="xforms-model-construct-done").  I can't
> figure out the syntax.  I don't want to redirect to the XML file in eXist
> itself, but load that file into the form.

I see; so the XML would go into an instance of the form. Maybe you can
try having a submission:

<xforms:submission  id="initial-load"
    resource="/exist/rest/db/projectname/{xxforms:get-request-parameter('id')}"
    serialization="none" replace="instance" instance="your-instance"/>

And you run that submission on xforms-model-construct-done:

<xforms:send ev:event="xforms-model-construct-done" submission="initial-load"/>

(Note that because the submission makes a reference to
xxforms:get-request-parameter(), you can only use it when the page is
produced by the XForms server. You won't be able to run it later. I
you need to, you'll have to store the value of that request parameter
in an instance.)

Alex
--
Orbeon Forms - Web forms, open-source, for the Enterprise
Orbeon's Blog: http://www.orbeon.com/blog/
My Twitter: http://twitter.com/avernet


--
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
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
Reply | Threaded
Open this post in threaded view
|

Re: Re: Re: Re: Re: Re: Re: Re: Most effective way to dynamically load a form

Ethan Gruber
Hi Alex,

Thanks a lot for your help.  It's working exactly the way I want it to now!

Ethan

On Tue, Nov 17, 2009 at 2:22 AM, Alessandro Vernet <[hidden email]> wrote:
Ethan,

On Mon, Nov 16, 2009 at 6:55 AM, Ethan Gruber <[hidden email]> wrote:
> Sorry for the confusion.
>
> What I want to do is load {xxforms:get-request-parameter('id')}.xml into the
> form automatically (on ev:event="xforms-model-construct-done").  I can't
> figure out the syntax.  I don't want to redirect to the XML file in eXist
> itself, but load that file into the form.

I see; so the XML would go into an instance of the form. Maybe you can
try having a submission:

<xforms:submission  id="initial-load"
   resource="/exist/rest/db/projectname/{xxforms:get-request-parameter('id')}"
   serialization="none" replace="instance" instance="your-instance"/>

And you run that submission on xforms-model-construct-done:

<xforms:send ev:event="xforms-model-construct-done" submission="initial-load"/>

(Note that because the submission makes a reference to
xxforms:get-request-parameter(), you can only use it when the page is
produced by the XForms server. You won't be able to run it later. I
you need to, you'll have to store the value of that request parameter
in an instance.)

Alex
--
Orbeon Forms - Web forms, open-source, for the Enterprise
Orbeon's Blog: http://www.orbeon.com/blog/
My Twitter: http://twitter.com/avernet


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




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