Get Form ID of an unsaved / unsubmitted form

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

Get Form ID of an unsaved / unsubmitted form

nyeager
Is there an easy way to get the document / form ID of a form? Essentially, I'm trying to make a very simple app that, upon saving of the form, grabs the document ID and emails it to a user, so they can resume at a later date if they want. I feel like I'm probably missing something simple.

I've tried using the following under the save-draft button:

...
save
then navigate("<a href="http://mydomain.com/blah.php?id={xxf:document-id()}">http://mydomain.com/blah.php?id={xxf:document-id()}") 

That actually looks like it works, however the ID it submits does not match up to the ID of the actual form, it's some other value. 

Any ideas here?

Thanks!
Nick

--
You received this message because you are subscribed to the Google Groups "Orbeon Forms" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Reply | Threaded
Open this post in threaded view
|

Re: Get Form ID of an unsaved / unsubmitted form

Erik Bruchez
Administrator
The actual document id can be obtained with:

     xxf:instance('fr-parameters-instance')/document

We need an API for that:

    https://github.com/orbeon/orbeon-forms/issues/1095

-Erik
Reply | Threaded
Open this post in threaded view
|

Re: Get Form ID of an unsaved / unsubmitted form

nyeager
Thanks for the reply and excuse my ignorance, but it sounds like there's not a quick way to grab this during a form runner event (save / nagivate) and pop it into the URL bar?

Ideally, I'm looking for an XPath value to use with 'navigate.'

Thanks!
Nick


On Fri, Jul 11, 2014 at 6:09 PM, Erik Bruchez <[hidden email]> wrote:
The actual document id can be obtained with:

     xxf:instance('fr-parameters-instance')/document

We need an API for that:

    https://github.com/orbeon/orbeon-forms/issues/1095

-Erik

--
View this message in context: http://discuss.orbeon.com/Get-Form-ID-of-an-unsaved-unsubmitted-form-tp4658640p4658650.html
Sent from the Orbeon Forms community mailing list mailing list archive at Nabble.com.

--
You received this message because you are subscribed to the Google Groups "Orbeon Forms" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].



--
Nick Yeager
Chief Technology Officer


80 Broad Street, 5th Floor

New YorkNY10004


484.274.3297

--
You received this message because you are subscribed to the Google Groups "Orbeon Forms" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Reply | Threaded
Open this post in threaded view
|

Re: Get Form ID of an unsaved / unsubmitted form

Erik Bruchez
Administrator
With 4.6, you can place XPath in the `navigate` action. So yes, you can, e.g.:

    navigate(uri = "/foo/{xxf:instance('fr-parameters-instance')/document}/bar")

-Erik
Reply | Threaded
Open this post in threaded view
|

Re: Get Form ID of an unsaved / unsubmitted form

nyeager
Hi Erik, sorry for the delays, I've done some digging and am attaching some relevant bits.

The code you mentioned above is what I actually had previously. When a user tries to save the form, they get an error dialog box:
"There was an error running the process. Please contact the application administrator."

The relevant lines in my properties-local.xml look like this:

<property as="xs:string" name="oxf.fr.detail.buttons.*.*" value="save-draft pdf send"/>

<property as="xs:string" name="oxf.fr.detail.process.save-draft.*.*" value='save 
then navigate(uri = "<a href="http://10.0.0.23/%7Bxxf:instance(%5C&#39;fr-parameters-instance%5C&#39;)/document%7D&#39;" target="_blank">http://10.0.0.23/{xxf:instance(\"fr-parameters-instance\")/document}")'/>


The traceback in the logs looks like the following: (Note, I've also tried difference combinations of quotes, unsuccessfully).

2014-08-13 22:09:57,321 ERROR XFormsServer  -     +----------------------------------------------------------------------------------------------------------------------+

2014-08-13 22:09:57,321 ERROR XFormsServer  -     |An Error has Occurred                                                                                                 |

2014-08-13 22:09:57,321 ERROR XFormsServer  -     |----------------------------------------------------------------------------------------------------------------------|

2014-08-13 22:09:57,321 ERROR XFormsServer  -     |Invalid source:                                                                                                       |

2014-08-13 22:09:57,321 ERROR XFormsServer  -     |Invalid input '\', expected CombinatorActionPair, OptWhiteSpace or EOI (line 1, pos 98):                              |

2014-08-13 22:09:57,321 ERROR XFormsServer  -     |save                                                                                                                  |

2014-08-13 22:09:57,321 ERROR XFormsServer  -     | then navigate(uri="<a href="http://10.0.0.23/{xxf:instance(\">http://10.0.0.23/{xxf:instance(\"fr-form-instance\")/document}")\                                 |

2014-08-13 22:09:57,321 ERROR XFormsServer  -     |                                                                                                                      |

2014-08-13 22:09:57,321 ERROR XFormsServer  -     |                                                                 ^                                                    |

2014-08-13 22:09:57,321 ERROR XFormsServer  -     |----------------------------------------------------------------------------------------------------------------------|

2014-08-13 22:09:57,321 ERROR XFormsServer  -     |Application Call Stack                                                                                                |

2014-08-13 22:09:57,321 ERROR XFormsServer  -     |----------------------------------------------------------------------------------------------------------------------|

2014-08-13 22:09:57,321 ERROR XFormsServer  -     |----------------------------------------------------------------------------------------------------------------------|

2014-08-13 22:09:57,321 ERROR XFormsServer  -     |Exception: org.parboiled.errors.ParsingException                                                                      |

2014-08-13 22:09:57,321 ERROR XFormsServer  -     |----------------------------------------------------------------------------------------------------------------------|

2014-08-13 22:09:57,321 ERROR XFormsServer  -     |org.orbeon.oxf.fr.process.ProcessParser$           |parse                         |ProcessParser.scala           | 114|


Any ideas?
Thanks!


On Mon, Jul 14, 2014 at 8:54 PM, Erik Bruchez <[hidden email]> wrote:
With 4.6, you can place XPath in the `navigate` action. So yes, you can,
e.g.:

    navigate(uri =
"/foo/{xxf:instance('fr-parameters-instance')/document}/bar")

-Erik

--
View this message in context: http://discuss.orbeon.com/Get-Form-ID-of-an-unsaved-unsubmitted-form-tp4658640p4658663.html
Sent from the Orbeon Forms community mailing list mailing list archive at Nabble.com.

--
You received this message because you are subscribed to the Google Groups "Orbeon Forms" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].



--
Nick Yeager
Chief Technology Officer


80 Broad Street, 5th Floor

New YorkNY10004


484.274.3297

--
You received this message because you are subscribed to the Google Groups "Orbeon Forms" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Reply | Threaded
Open this post in threaded view
|

Re: Get Form ID of an unsaved / unsubmitted form

Erik Bruchez
Administrator
Reply | Threaded
Open this post in threaded view
|

Re: Get Form ID of an unsaved / unsubmitted form

Erik Bruchez
Administrator
Nabble messed up with my message, and maybe it messed up with yours too ;) Either way the advice holds if you are using 4.6:

<property as="xs:string" name="oxf.fr.detail.process.save-draft.*.*">
    save then navigate(uri = "http://10.0.0.23/{xxf:instance('fr-parameters-instance')/document}"
</property>

This way you can avoid having to escape quotes.

-Erik
Reply | Threaded
Open this post in threaded view
|

Re: Get Form ID of an unsaved / unsubmitted form

nyeager
As always, thanks for your help, this is working now. Figured something simple was messed up! :)

-Nick


On Thu, Aug 14, 2014 at 6:29 PM, Erik Bruchez <[hidden email]> wrote:
Nabble messed up with my message, and maybe it messed up with yours too ;)
Either way the advice holds if you are using 4.6:

<property as="xs:string" name="oxf.fr.detail.process.save-draft.*.*">
    save then navigate(uri =
"<a href="http://10.0.0.23/%7Bxxf:instance(&#39;fr-parameters-instance&#39;)/document%7D" target="_blank">http://10.0.0.23/{xxf:instance('fr-parameters-instance')/document}"
</property>

This way you can avoid having to escape quotes.

-Erik

--
View this message in context: http://discuss.orbeon.com/Get-Form-ID-of-an-unsaved-unsubmitted-form-tp4658640p4658726.html
Sent from the Orbeon Forms community mailing list mailing list archive at Nabble.com.

--
You received this message because you are subscribed to the Google Groups "Orbeon Forms" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].



--
Nick Yeager
Chief Technology Officer


80 Broad Street, 5th Floor

New YorkNY10004


<a href="tel:484.274.3297" value="+14842743297" target="_blank">484.274.3297

--
You received this message because you are subscribed to the Google Groups "Orbeon Forms" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].