Taking care of form data
Submitted by Johan Falk on Mon, 01/23/2012 - 07:42
This screencast shows some more aspects of form API, namely how to write functions that are called when forms are submitted. It also includes how to set default values for form elements. In more detail, this screencast includes:
- That functions named FORM_ID_submit($form, $form_state) will by default be called on form submissin
- That data storing should NOT be done by the form submit function, but by a separate function (since data handling should be possible to do without any forms)
- That submitted values can be found in $form_state['input']
- The two functions variable_set and variable_get, used for storing simple and small variables
- That the property #defaule_value can be used to set default values for form elements
- An example of how to use the implode() and explode() functions to manage line breaks
Additional Resources:
Leave a comment