add some user feedback to ajax result

This commit is contained in:
Nathan Coad
2016-06-03 13:11:03 +10:00
parent 17076469de
commit 940329bdd7

View File

@@ -375,6 +375,7 @@ function booking_manual_email_form($form, &$form_state)
'#title' => t('Preselect Attendees'),
'#options' => $preselection_options,
'#default_value' => '---',
'#suffix' => '<div id="booking_email_preselection_suffix_wrapper"></div>',
'#ajax' => array(
'event' => 'change',
'callback' => '_booking_email_get_default_selection_callback',
@@ -529,6 +530,8 @@ function _booking_email_get_default_selection_callback($form, $form_state) {
);
$output_html = render($replacementform_data['booking-email-default-ids']);
$feedback_html = t("<div id=\"booking_email_preselection_suffix_wrapper\">Number of people selected: <b>:num</b></div>",
array(':num' => count($defaults)));
//watchdog('booking_debug', "<pre>Manual Email ajax html\n@info</pre>", array('@info' => print_r( $output_html, true)));
//return a sequence of commands to run
@@ -536,6 +539,7 @@ function _booking_email_get_default_selection_callback($form, $form_state) {
'#type' => 'ajax',
'#commands' => array(
ajax_command_replace("#booking_email_default_ids_wrapper", $output_html),
ajax_command_replace("#booking_email_preselection_suffix_wrapper", $feedback_html),
// This will call the command bookingEmailIDs in our custom JS file.
array('command' => 'bookingAjaxCheckboxes',
'formDataElement' => 'booking_email_default_ids', //name of the hidden form element that contains the json data