I created a custom submit button for the user-login form using #markup because I couldn't alter submit button html to resemble what I needed. The second custom submit button with the needed html is added with:
$form['submit2'] = array(
'#markup' => '<p class="submit"><button type="submit" name="submit"><i class="icon-arrow-right icon-large"></i></button></p>');
I then added a "hideme" class to the orginal button with $form['actions']['submit']
['#attributes']
(deleting it stopped the other submit from working).
So far so good. But now I would like to validate the login form using AJAX. Only if I add the #ajax
key to $form['submit2']
, the callback is never called. This only seems to work with regular form items.
Is it possible to trigger an Ajax callback on a #markup
element (in hook_form_alter
)? I'm using Drupal 7.