hello,
how to create new form record using crud? I need prepopulate form-record before redirecting user to fill it. There is 'put' method that can do this, but it requires complete form-record data to be send. I need sth like: create new form record, retrieve initial xml from it, modify it and save it back. Then create url + id of that new form record and redirect user there to fill it. thanks, Radek |
Administrator
|
Hi Radek, I'm afraid currently we don't have an API that does all those steps. You'll need to: 1. Do a GET against CRUD API to retrieve the form definition, from which you can extract an empty "template" document. 2. Choose an ID for your new instance. If you can call Orbeon Forms' code, you can use SecureUtils.randomHexId(). 3. Do a PUT against the CRUD API to store the document. Alex On Fri, Sep 9, 2016 at 5:37 AM, rac <[hidden email]> wrote: hello, 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].
--
Follow Orbeon on Twitter: @orbeon Follow me on Twitter: @avernet |
when i request form definition (/orbeon/fr/service/persistence/form/app1/f1), I get only:
<forms> <form operations="*"> <application-name>app1</application-name> <form-name>f1</form-name> <title xml:lang="en">Untitled Form</title> <description xml:lang="en"/> <singleton>false</singleton> <last-modified-time>2016-09-06T08:56:17.969Z</last-modified-time> </form> </forms> am I using right method for retrieving form definition? I found it here: https://doc.orbeon.com/form-runner/api/persistence/ On the other hand i also found: "On the other hand, when Form Builder publishes a form definition, it stores it where Form Runner will find it, that is under: /crud/[APPLICATION_NAME]/[FORM_NAME]/form" but /orbeon/crud/app1/f1/form returns "Orbeon Forms - Page Not Found". thank you, Radek |
Administrator
|
Hi Radek,
/fr/service/persistence/form is what is referred to as the "Form Metadata" API. It only returns some information about the form, or forms. You can think of it as the API you'll want to call if you want to get a list of published forms, for instance to create a page showing users what forms are available to them. E.g. this is the API used by the Form Runner home page. https://doc.orbeon.com/form-runner/api/persistence/forms-metadata.html To retrieve a full form definition, you should use the CRUD API, e.g.: /fr/service/persistence/crud/acme/demo/form/form.xhtml https://doc.orbeon.com/form-runner/api/persistence/crud.html Alex
--
Follow Orbeon on Twitter: @orbeon Follow me on Twitter: @avernet |
hello,
It works, with small exception related to orbeon 4.8 'iteration' elements, like here: version found in prototype inside form-definition: <repeated-contact> <repeated-contact-iteration> <repeated-email>test1@a.com</repeated-email> <repeated-phone>p1</repeated-phone> </repeated-contact-iteration> <repeated-contact-iteration> <repeated-phone>p2</repeated-phone> <repeated-email>test2@a.com</repeated-email> </repeated-contact-iteration> </repeated-contact> vs version expected by form-record: <repeated-contact> <repeated-email>test1@a.com</repeated-email> <repeated-phone>p1</repeated-phone> </repeated-contact> <repeated-contact> <repeated-phone>p2</repeated-phone> <repeated-email>test2@a.com</repeated-email> </repeated-contact> What is most simple way to synchronize them? Can I say somehow "data-format-version=edge" when putting new form record, or is there any other way to make runner accept iteration element? Are there other differences between prototype stored in form-definition and form-record? thank you, Radek |
Administrator
|
Hi Radek,
Are you saying that you'd like the CRUD API to convert data from the "4.0" format (without the -iteration elements) to the "edge format" (with the -iterations elements)? Or that you'd like data to be stored in the "edge" format in the database? Alex
--
Follow Orbeon on Twitter: @orbeon Follow me on Twitter: @avernet |
Scenario is following:
I retrieved form definition and extracted prototype of form record from it. I used 'put' and used above data as body param. I opened in orbeon ui newly created form record. Result is that eveything except 'iteration' elements work (because prototype in form-definition has different schema than 'put' method expects). I hope to have one universal method for creating form-record that would work with every form (I guess orbeon has sth like that in its internals, would be nice to have it as crud method.). thank you, Radek |
Administrator
|
Hi Radek, Yes indeed, there is code in Orbeon Forms that removes those elements, and adds them, as necessary, but it isn't exposed as an API right now. I imagine that the PUT could support being told about the data-format-version, either as a request parameter or HTTP header, and if set to "edge", remove the "iteration elements". For now, I've created an RFE for this: (If this is a blocker for you, and if your organization has a subscription with us, I'd recommend you contact us to see how this could be developed as a sponsored feature.) Alex On Wed, Sep 21, 2016 at 7:03 AM, rac <[hidden email]> wrote: Scenario is following: 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].
--
Follow Orbeon on Twitter: @orbeon Follow me on Twitter: @avernet |
Free forum by Nabble | Edit this page |