I figured out how to add form fields using the buildForm hook. I am adding a select element to a participant profile on an event registration form. Do the values from the added fields get saved when the user submits the form? If so, where can I see them? If not, how do I store them with the other profile info using code? The custom fields feature does not work (DB Error: Already exists) right now or else I would use that.
-
You might want to ask a separate question about fixing your custom fields issue! There is a lot of capability built in for custom fields that is not there for your own manual fields.– Aidan ♦Commented Mar 27, 2018 at 14:14
-
@Aidan I have just posted a question on how to solve my custom fields issue. It can be found at link Would you mind taking a look?– ermSOCommented Mar 27, 2018 at 15:54
2 Answers
buildForm
hook is used to add the elements on the form. To store the values of your select element, you need to look at postProcess
hook which is called after the form is submitted.
You'll get the submitted select value in $form
parameter. Use this and store the value in your expected table.
As Jitendra explained you can use the postProcess
hook and the $form
parameter. The submitted values will be in an array $form->_submitValues
.