Ext JS - Learning Center

Tutorial:Example FormPanel using JSON to load and submit with Coldfusion or PHP

From Learn About the Ext JavaScript Library

Revision as of 08:08, 28 December 2008 by Murrah (Talk | contribs)
(diff) ← Older revision | Current revision (diff) | Newer revision → (diff)
Jump to: navigation, search

One of the most common actions in web/database work is to load a specific record into a form, allow the user to edit it and then save the changes back to the server. There wasnt an Ext 2.0 example of this so I have written one.

This is an example FormPanel that uses JSON to load and submit records from/to the server. I have provided both Coldfusion and PHP server-side scripts.

The example is built on the XML example provided as part of the Ext package.

There is a simple version that does pretty much what the XML version does.

The more complex example adds a few fields, has a bit more client side validation and (more importantly) is as robust as I can make it regarding error handling for the load and submit. There is a big comment in the json-form.js file about this.

The more complex example also allows you to specify a record ID to load to simulate how your code might load a specific record from a database for editing. The server-side scripts dont actually use a database - there are 2 hard coded records (recordID 1 and 2). Any other recordID will return a "Record not found" message.

NOTE: I created this example a long time ago and have been encouraged to post it here so that is what I am doing. I wont repeat the details here. Please see forum post for the example files and discussion.