I am trying to accomplish the following functionality:
I have a profile2 registration form to which I have added a custom form element (just a submit button) using
The submit button has a
#submit property set to a
For debugging purposes, the callback function just displays a
The general idea is that the button is used to gather information from a webservice (in the callback function) and then fill the form with the returned values.
The user can then check the values and submit the user registration form.
When I click the custom submit button, it fires the custom callback. But when I click the user register form submit button, it also fires the custom callback?
I have checked the dpm of $form and the
#submit properties are as follows:
$form['#submit'] == de default (correct) user registration callback $form['custom']['#submit'] == de custom submit handler
So, any clues on why the default submit handler no longer works?
My form alter implementation looks like this (just add an image button)
$form['custom'] = array( '#name' => 'custom', '#type' => 'image_button', '#src' => drupal_get_path('module', 'custom') . '/logo.png', '#value' => t('get data'), '#prefix' => '<div class="button-wrapper">', '#attributes' => array('alt' => t('get data')), '#suffix' => '</div>', //'#weight' => -99, '#submit' => array('custom_callback'), );
Thanks in advance!