Wednesday, May 30, 2012

What happens after users fill out a form?

Orbeon Forms focuses on making it easy for form authors to create and deploy forms, and for end users to fill out those forms. When you create and deploy a form with Form Builder, you get the URL of a new page for that form. You can point users to that page, so they can fill out the form.
But what happens when users are done filling out the form? There are several ways to setup Orbeon Forms, but we’ll cover here the common use case where you want to have a Submit button that:
  1. Saves the data in a database, per your configuration. (For more details, see which databases Orbeon Forms supports out of the box.)
  2. Takes users to another page.
You can do this by setting the following 3 properties. If you haven’t setup properties before, you might find this overview of properties useful.
<property as="xs:string"  name="oxf.fr.detail.buttons.*.*" value="submit"/>
<property as="xs:string"  name="oxf.fr.detail.submit.buttons.*.*" value="go"/>
<property as="xs:string"  name="oxf.fr.detail.submit.go.uri-xpath.*.*"
                          value="'http://www.your-site.com/form-submitted'"/>
Let’s go through those 3 properties:
  1. The first property defines which buttons are shown on the form; here we only include the Submit button, as this is the one we’re interested in, but you might want to include additional buttons.
  2. The second property configures the dialog that shows upon submission, which you can see in the screenshot below. Here include one button, taking users to a page of your choosing.
  3. The third property defines the page users are taken to. To put a static value, add single quote inside the double quotes as done here. (The value can also be dynamic: you can provide an XPath expression returning a URL, which runs on the data entered by users.)

Dialog upon submission
Dialog upon submission

What if this form is part of a workflow, and that depending on the data users entered, you want to take them to a different page? Then the workflow send button is what you are looking for. To end users, the workflow send button looks like a regular Submit button. But it is one that you can configure to do much more; for instance, it can:
  • Optionally, generate a PDF of the form, with the data entered by users.
  • Optionally, send out an email, with the XML data and/or the PDF.
  • Optionally, store the XML data and/or the PDF in Alfresco.
  • Take the user to a page, either sending the XML data or the PDF to that page.
The page mentioned in this last step is one you provide. That page receives an HTTP POST with the data entered by users, so you can implement it outside of Orbeon Forms using the technology of your choice (servlet, PHP…). Maybe based on the information entered by users, you can implement it to direct users to the next step in their workflow, which may involve filling out another form. For more details, see the documentation for the workflow send button.

No comments:

Post a Comment