Join Jon Peck for an in-depth discussion in this video Handling successful form submissions and saving variables, part of Drupal 7: Custom Module Development.
Once validation is passed, the Drupal form API looks for submit callback. …Return to the IDE, then create a new docblock for the submission callback. …Process a validated Wind Farm admin setting submission. …Similar to the way the validate function was named, a submit callback name starts with the …form name followed by underscore submit. Same as a validate function, it takes two parameters; …the form then the form state passed by reference; windfarms_admin_settings_form_submit, form …then form_state, passed by reference.…
The first thing I want to do is tell the form to rebuild so the submitted values will be …displayed even on success, instead of showing the default values. …To do that I will manually set a flag in the form state. …As form state was passed by reference, changes within this function will affect other form processors. …The flag name is rebuild and accept Boolean values true or false. …I'll start with a comment to describe what I'm about to do; Rebuild the form, form_state …
- Creating your first module
- Interacting with hooks
- Working with permissions and roles
- Controlling access
- Adding a menu item to an admin interface
- Using the Form API (FAPI) to quickly create a form
- Creating custom form validation
- Manually creating a custom content type
- Validating user input
- Importing content using feeds
- Creating a block
- Understanding best practices and coding standards
Skill Level Advanced
Q: gmap3_tools is not working the way I expected it to. What version of gmap3_tools should I be using?
A: Use the free exercise file containing the version of gmap3_tools used for recording; the published version of the module on drupal.org has changed since recording and is not backwards compatible.
Q: I attempted to run the Drupal site root from the project files, but the site isn't loading. Why not?
A: The Drupal configuration file in sites/default/settings.php contains database configuration specific to the environment used to record the movie. This may be different than your environment. Edit the file and search for "windfarms" - you may need to change the database host, username, password, db name and port to match your specific environment.