Hi,

I am struggling with an issue I am sure it's a trivial for those more experienced with Dialog, CTools, jQuery, etc.

I have a form that has to be reloaded and displayed in a dialog, after being submitted and all submit callback functions were executed successfully.

So, instead of:

- opening a form in a dialog,
- completing the form,
- submitting the form,
- displaying status messages from a submit callback functions inside the dialog,
- closing the dialog,
- reopening the dialog the same way as I did first time.

I wanna do this:

- opening form in a dialog,
- completing the form,
- submitting the form,
- displaying status messages from a submit callback functions inside the dialog along with the same form reloaded (sort of like a regular page refresh) after submission,
- continue to use the form in the dialog if needed,
- closing the dialog.

Many thanks.

Cheers.
Elvin.

Comments

drewish’s picture

Status: Active » Fixed

As long as both forms are "AJAX-able" then you shouldn't have any problem. In your submit handler you can do something like:

  if ($form_state['ajax']) {
    $options = array(
      'height' => '50%',
      'width' => '50%',
      'position' => 'center',
    );
    dialog_ajax_render("A title", "Content of the dialog", $options);
    // or you could do a dialog_form_render()
  }
  else {
    $form_state['redirect'] = 'path/where/non/ajax/users/should/go';
  }

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.