jqueryUI $.dialog() control is included on the form like this:
'#attached' => array(
'library' => array(
array('system', 'ui.dialog'),
),
)
I have an AJAX callback that returns an array of AJAX commands like this:
return array(
'#type' => 'ajax',
'#commands' => array(
ajax_command_invoke("#dialog-container", 'remove'),
ajax_command_replace("#dialog-container-holder", render($form['form']['dialog_container_holder'])),
ajax_command_invoke("#dialog-container", 'dialog', array($dialog_config)),
)
);
Part of the form, "#dialog-container" becomes a modal dialog and is filled with the proper form elements. The section of form inside the dialog includes a "select" that is handled by a different AJAX callback. The "select" triggers its callback but $form_state['triggering_element']['#value'] is empty - not updated with the select's value. How can I get $form_state to be updated correctly?
Note: In the callback that builds the dialog (above), I have to remove the previously-created "#dialog-container" or a duplicate section is inserted into the DOM and causes id conflict, etc. I tried to call $.dialog('destroy') on the old section (instead of remove) but that didn't prevent the duplication.