Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

If you enter ID 99 (which does not exist), Live Forms   will GET .../customers/99, which returns an empty document. The form will be displayed with default values (as entered originally by the designer). When submitted, the resulting XML document will be PUT to .../customers/99. This PUT will create a new customer with ID 99 (the behaviour depends on the implementation on the server - in our example, the PUT creates the customer).

...

This example is a good way to understand Live Formsunderstand ' s handling of document URIs and the powerful capabilities of composing multiple document resources into view resources. You can download the entire example including source code and forms by clicking here.

This example follows the principles of REST and uses the Restlet framework but you can use any framework or server-side model that you like. As mentioned earlier, Live Forms   forms can be thought of as View Resources that compose one or more Entity Resources (documents). In this example we have entities Customer and List of Customers. Reproduced here are the methods that they support.

...

This form is described in the Creating a new document section above. When instantiated, it does a POST to the Read URI using the second method in the table above. This causes the server to create a new customer and return the URI of that customer. Live Forms   will automatically follow this URI, GET the representation of the customer and display the form (presumably with empty values). When the user enters all required fields and submits the form, Live Forms   will automatically PUT the resulting XML document to the URI for the newly created customer thereby updating the customer.

...