FormSaver.cfc 1.0

I often need to create a multi-page form or load a form with old data. FormSaver helps with both by providing a generic way to save form data.

FormSaver is built to save the data for a form, not the data that a form might represent (which will hopefully make sense shortly).

FormSaver can save the data using either DataMgr or SessionMgr (which is basically a SessionFacade). Just pass in the one you want to use to the init() method of FormSaver (with an argument name of "DataMgr" or "SessionMgr" respectively).

In order to save a form's data, use the store() method with the following arguments:

  • formdata: The Form structure itself (so, theoretically, FormSaver could save any simple structure)
  • formname: A name by which to reference this form (used for retrieving the value later)
  • usertoken: Any string to identify the user (required only if using DataMgr)

 In order to get back the saved structure, use the retrieve() method with the following arguments:

  • formname: The name to reference the form you want to retrieve (from the argument of the same name above)
  • usertoken: A string to identify the user (again, required only if using DataMgr)

You can also delete a stored form using the delete method with the following arguments: 

  • formname: The name to reference the form you want to retrieve (from the argument of the same name above)
  • usertoken: A string to identify the user (again, required only if using DataMgr)

When using DataMgr, FormSaver saves data to a table that it creates (via DataMgr). The name of this table is set via the "tablename" argument of the init() method (it defaults to "frmSaveds").

FormSaver is a very simple component that can help you temporarily store form values. This can be helpful for multi-page forms, especially if you want a user to be able to return to a form where they left off in a previous visit.

FormSaver is open source and free for any use. 

 

Comments (Comment Moderation is enabled. Your comment will not appear until approved.)
BlogCFC was created by Raymond Camden. This blog is running version 5.8.001.