form_example_tutorial | Main Form tutorial page. |
form_example_tutorial_1 | Tutorial Example 1. |
form_example_tutorial_10 | Example 10: A form with a file upload field. |
form_example_tutorial_10_submit | Submit handler for form_example_tutorial_10(). |
form_example_tutorial_10_validate | Validate handler for form_example_tutorial_10(). |
form_example_tutorial_11 | Example 11: adding a confirmation form. |
form_example_tutorial_11_confirm_name | Example 11: A form generated with confirm_form(). |
form_example_tutorial_11_confirm_name_submit | Submit function for form_example_tutorial_11_confirm_form(). |
form_example_tutorial_11_submit | Submit function for form_example_tutorial_11(). |
form_example_tutorial_2 | This is Example 2, a basic form with a submit button. |
form_example_tutorial_3 | Example 3: A basic form with fieldsets. |
form_example_tutorial_4 | Example 4: Basic form with required fields. |
form_example_tutorial_5 | Example 5: Basic form with additional element attributes. |
form_example_tutorial_6 | Example 6: A basic form with a validate handler. |
form_example_tutorial_6_validate | Validation handler for Tutorial 6. |
form_example_tutorial_7 | Example 7: With a submit handler. |
form_example_tutorial_7_submit | Submit function for form_example_tutorial_7(). |
form_example_tutorial_7_validate | Validation function for form_example_tutorial_7(). |
form_example_tutorial_8 | Example 8: A simple multistep form with a Next and a Back button. |
form_example_tutorial_8_next_submit | Submit handler for form_example_tutorial_8() next button. |
form_example_tutorial_8_next_validate | Validate handler for the next button on first page. |
form_example_tutorial_8_page_two | Returns the form for the second page of form_example_tutorial_8(). |
form_example_tutorial_8_page_two_back | Back button handler submit handler. |
form_example_tutorial_8_page_two_submit | The page 2 submit handler. |
form_example_tutorial_9 | Example 9: A form with a dynamically added new fields. |
form_example_tutorial_9_add_name | Submit handler for "Add another name" button on form_example_tutorial_9(). |
form_example_tutorial_9_remove_name | Submit handler for "Remove name" button on form_example_tutorial_9(). |
form_example_tutorial_9_submit | Submit function for form_example_tutorial_9(). |
form_example_tutorial_9_validate | Validate function for form_example_tutorial_9(). |
Comments
Additional submit handler
I have a module installed. I want to add an additional submit handler in to submit function of the module. for example I can add additional submit handler to a function with the following code in drupal 6.
How can achieve the above functionality in drupal 7?
form_state['values'] VS form_state['input']
The difference between form_state['values'] VS form_state['input'] should really be included in at least one of these examples, as this functionality, as written, is misleading.
You can reference your data from the $form_state object, as displayed in these examples. Consider:
You can reference this value in the validation or other functions by accessing the $form_state array, as such:
This is shown in several examples. *However,* if you pre-populate a form with a value, like so:
then trying to get the value with the method above will return 'My Title' *instead* of the user-modified value. To get the modified value, in my experience, you must do it like so:
This should return the user-supplied value you're more likely looking for. Note that using $form['title_field']['#value'] *also* returns the value *before* the user modified it. This is not obvious, and it would make sense to clarify this in the example module.
I know this is old but you
I know this is old but you shouldn't be setting #value here which is why you're getting the wrong result in $form_state['values'].
If you want to provide an initial value that the user can then modify you should set #default_value, then the correct user entered value will be in $form_state['values'].
Re write sections titles
They are all out of order,
1 should become 01 2 should become 02 ect...
Heads Up!
My experience has shown that spaces in the form element names will cause the entered values to be missing from the $form_state['values'] array. Refer to my comment at https://drupal.org/comment/8285811#comment-8285811.