How is it possible to create simple confirmation popup dialog boxes in Drupal 7?
I've searched a lot, but I found tons of non-working suggestions and code.
How is it possible to create simple confirmation popup dialog boxes in Drupal 7?
I've searched a lot, but I found tons of non-working suggestions and code.
I got it!!!
Here's a simple 100% functioning exmple:
$form['delete'] = array(
'#type' => 'submit',
'#value' => t('Delete'),
'#attributes' => array('onclick' => 'if(!confirm("Really Delete?")){return false;}'),
);
I hope this helps.
Happy coding :)
Drupal has a native confirm_form() function, but it is server side rather than Javascript based, which is what I assume you mean.
There is a sandbox module which enables this type of functionality to be built relatively easily: https://www.drupal.org/sandbox/cmcintosh/2644004