Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Web and WebWorks Development

Offline Forms

by BlackBerry Development Advisor ‎02-16-2010 08:54 AM - edited ‎09-17-2010 04:02 PM (2,714 Views)

Exercise

 

In this lab, you will create an offline form submission example.  Offline form submission allows users to fill out an HTML form and, when out of a wireless coverage area, have the browser queue it for submission to the server.  The browser submits the form as soon as the device is in a wireless coverage area.  You will need to have filled out and submitted the page at least once while in a wireless coverage area before the offline functionality will work.

 

Prerequisites

-          Web server to host the HTML forms

-          IDE for developing your web pages

Objectives

-          Discover how to create offline forms

Setup Tasks

-          In your IDE of choice, create the following 3 web pages:

-          Form Submission page

  • Contains the form which will be enabled for offline submission

-          Confirmation page

  • Notifies the user that the page will be submitted whenever the device is back in coverage (if not currently in coverage)

-          Data Collection page

  • Collects the submitted information

 

Tasks

-          Create a Form Submission page

  • Create a web form that will contain all of the information to be collected from the end user

-          Create a Confirmation page

  • Create a web form that will display a message to the user that the form will be submitted whenever the device is back in coverage (if not currently in coverage)

-          Create a Data Collection page

  • Create a web form that will collect all of the information submitted in the form submission page
  • The data will be collected in the post data from the form submission page

-          Form Submission page

  • Set the following headers to create the form queue
  1. “x-rim-queue-id” – Specifies the Offline Form Queue to which any GET or POST requests from form submissions on this page should go.  Set this value equal to “OfflineForms”.
  2. “x-rim-next-target” – Specifies the next page to load after sending any GET or POST requests resulting from this page.  Set the value equal to the url of the confirmation page
  • The following code are samples of how to set the header values:
    1. Java
    2. HttpConnection.setRequestProperty(("x-rim-queue-id", "offlineforms");

      HttpConnection.setRequestProperty(("x-rim-next-target ", " Confirmation.htm ");

    3. .Net (C#)
    4. Response.AddHeader("x-rim-queue-id", "offlineforms");

      Response.AddHeader("x-rim-next-target", "Confirmation.htm");

  • Set the form’s action attribute equal to the url of the Data Collection page
  • -          Start the Mobile Data Service (MDS) simulator.

    -          Start the Device simulator

    -          Open the Form Submission page in the browser

    -          The result should be similar to the following diagrams

    Contributors