When changing the form, you also need to add a view handler to the module; this way, your module will be called when the form is submitted, and you can save the value of the added field.
If there is more than one button, it is advisable to add a send handler to the specific button in which you need to act. For example, suppose a form has two submit buttons: Save and Delete; if you add a submit handler using $form[#submit][] = "my module_form_submit"; , then the send handler is called even when the "Delete" button is clicked.
As indicated in the Form Buttons, custom #submit and #validate handlers can define :
All forms can have the properties "#validate" and "#submit", containing lists of checks and submit handlers that should be executed when the user submits data. Previously, if several submit buttons were present on the form in order to initiate various actions (for example, updating the record and deleting), it was necessary to check the incoming $ form_values โโ['op'] for the name of the button pressed, and then execute another code based on its value .
Now you can specify the #validate and #submit properties on each individual form, if you wish.
When a particular button is used to submit a form, its validation and submit handlers will be used, not standard forms. If none of them are specified at the button level, form level handlers will be used instead.
In addition, the 'op' element in form values โโis outdated and should not rely on reports:
As discussed above, each button can have the associated functions "#validate" and "#submit". Thus, there should be one button that represents the form and which calls the regular handlers $form_id_validate and $form_id_submit . Any additional buttons that should call different validation or send functions must have button-specific functions . Also note that the โopโ element in the form values โโcorresponding to the button pressed when it is somewhat in the form in Drupal 5.x should no longer be relied upon and may be absent.