Mobile Form data submission

Mobile Form is a form after all, a way to capture user data at the end of the day. Once you got the data from users, you want to feed that data for further business processing.  If you see my first post on mobile forms you would notice there is a API parameter submitUrl that can be of help here. You can configure your Mobile Form to post data in xml format to your service on submission of the forms. Since you can invoke any LiveCycle process or service RESTfully, you can technically trigger a process on form submission. In this post, I’ll describe how to trigger a process on form submission in detail. You can follow the same approach to POST the form data to any service.

All LiveCycle processes can be configured to be invoked over REST endpoint. You can create a process in your application and configure it for default start point. You can create a process to have input and output variable.

Mobile Form posts data to the specified submitUrl via data request parameter. If you don’t specify custom any “submitUrl”, the default submission servlet will show you the data in your browser. You can easily customize the default submission servlet and send data for further processing.

You can download custom submission servlet package from here and install it via package manager by browsing http://<server>:<port>/lc/crx/packmgr. For details see package manager help.

Now download the FormSubmission LiveCycle process and import it following the instructions. You can create your own process as well. The important part is to get the REST url of the process. The rest url of the process turns out to be http://localhost:8080/rest/services/<ApplicationName>/<ProcessName>:1.0 as shown in the screenshot of workbench.

process1

 

If you hit the REST url in the browser, it will ask for credentials of a user that can run this service or process. You can also disable the authentication required for running this process, for details look for adobe help.

http://localhost:8080/lc/content/xfaforms/profiles/default.html with the following parameters:

  • contentRoot repository:///Applications/FormSubmission/1.0
  • template=SimpleForm.xdp
  • submitUrl=Encode the URL and then pass(http://localhost:8080/lc/content/xfaforms/submission/default.lcprocess?postProcess=http://localhost:8080/rest/services/FormSubmission/archiveForm:1.0)

 

As you can see, the submitUrl is pointing to the custom servlet with a request parameter “postProcess” where custom servlet further posts data. The “postProcess” service could be any other servlet but in this case it is the REST url of the LiveCycle process.

The attached form in the Form Submission collateral has just two fields and the “archiveProcess” creates a flat pdf  from the submitted data. You can test the form by rendering it and when you submit the form, it triggers the LiveCycle process and generate pdf out of it and serve it in the browser.

 

 

 

12 Responses to Mobile Form data submission

  1. Darren says:

    Hey Rag,
    Theres a bug in your JSP where it tries to detect the extra (undocumented) request parameter postField.
    Your code incorrectly looks for postProcess not being null and then expects postField to be in the request params, so it will never post to the “data” param in the LC process. I think your JSP should be:

    RequestParameter postFieldParam = requestParameterMap.getValue("postField");
    if(postField == null) {
    postField = postFieldParam.getString();
    }

    Darren

    • Raghavendra Pandey says:

      Thanks for pointing that out. Yes I should have checked null for postFieldParam. I have updated the jsp in the uploaded package.

      • Darren says:

        No problem :) Your example has helped me out quite a bit.
        I would like to know how to get the actual Submit button that was pressed to submit the data (I want two different submit actions). This was available using the old FormsService before but I cant find where you get it using the new com.adobe.forms.service.LCFormsService.
        thanks
        Darren

        • Raghavendra Pandey says:

          The reference to submit submit button is not passed on to the submit endpoint as of ES4.

          • Darren says:

            So how would you link another button to a submit process so it can extract the form data? Can you create another profile within CRX and directly link to that action from the button?

          • Raghavendra Pandey says:

            You can certainly do that and create a profile and get the submit action there. I’ll do a follow up blog and show how to do that.

  2. Thibault Griez says:

    Thanks for this very informative post :)
    I just have one question: how do I configure the HTTP Submit element in my form (through the Designer) to use the submitUrl ? I have tried but the URL property set up in the designer is always used, even if blank…

    Thx :)

    • Raghavendra Pandey says:

      I am not sure if I got your question. You want to configure submitUrl in your HTTP Submit button, in that case the expectation is it will be used.

  3. Pingback: Smart submission – part II : LiveCycle Process

  4. Jack says:

    Has this changed in sp1?

Leave a Reply

Your email address will not be published. Required fields are marked *


seven + 8 =

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>