Closed (duplicate)
Project:
Automodal
Version:
6.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
26 Jun 2010 at 22:27 UTC
Updated:
27 Oct 2010 at 12:16 UTC
When I add the code (found elsewhere on the site), the Automodal module DOES successfully automatically close the modal window on submit... works great.
Problem is, it also breaks the admin so I can't activate/deactivate modules or change some admin settings. I have tried with/without the code and with/without the module... this is the culprit:
/***
* Automatically close on form submit
*/
function automodal_form_alter(&$form, $form_state, $form_id) {
$form['#action'] = '';
$form['buttons']['submit']['#submit'][] = 'automodal_close_form_submit';
if ($_GET['automodal']=='true') {
$form['#submit'][] = 'automodal_close_form_submit';
modalframe_child_js();
}
}
function automodal_close_form_submit($form, &$form_state) {
if ($form_state['values']['op'] == t('Save')) {
modalframe_close_dialog(array('redirect' => TRUE));
}
}
I have been adding this to the end of the automodal module to get it to work. This would be a great optional feature to add... if it didn't break the admin!
thoughts?
ron
Comments
Comment #1
mfer commentedThis is a dupe of #685364: close modal on form submit.
Something for this will go in soon. :)
Comment #2
rlnorthcuttFor any who tread here later - the problem was that I was overriding the submit function on every form. I just needed to move the
Like this:
It all seems to work fine for now - but hopefully a better solution will be patched in soon.
Comment #3
Berliner-dupe commentedThis Code dont work!
I copy it to the end from automodal.module and refresh the site
Fatal error: Cannot redeclare automodal_form_alter() (previously declared in E:\xampp\htdocs\projekt\sites\all\modules\automodal\automodal.module:191) in E:\xampp\htdocs\projekt\sites\all\modules\automodal\automodal.module on line 228
line 228 is }
Comment #4
mfer commented@Berliner The closing functionality is already built into the automodal module. Disregard #2.