add some user feedback to ajax result
This commit is contained in:
@@ -375,11 +375,12 @@ function booking_manual_email_form($form, &$form_state)
|
|||||||
'#title' => t('Preselect Attendees'),
|
'#title' => t('Preselect Attendees'),
|
||||||
'#options' => $preselection_options,
|
'#options' => $preselection_options,
|
||||||
'#default_value' => '---',
|
'#default_value' => '---',
|
||||||
'#ajax' => array(
|
'#suffix' => '<div id="booking_email_preselection_suffix_wrapper"></div>',
|
||||||
'event' => 'change',
|
'#ajax' => array(
|
||||||
'callback' => '_booking_email_get_default_selection_callback',
|
'event' => 'change',
|
||||||
|
'callback' => '_booking_email_get_default_selection_callback',
|
||||||
'wrapper' => 'booking_email_default_ids_wrapper',
|
'wrapper' => 'booking_email_default_ids_wrapper',
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
$form['submit'] = array (
|
$form['submit'] = array (
|
||||||
@@ -529,6 +530,8 @@ function _booking_email_get_default_selection_callback($form, $form_state) {
|
|||||||
);
|
);
|
||||||
|
|
||||||
$output_html = render($replacementform_data['booking-email-default-ids']);
|
$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)));
|
//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
|
//return a sequence of commands to run
|
||||||
@@ -536,6 +539,7 @@ function _booking_email_get_default_selection_callback($form, $form_state) {
|
|||||||
'#type' => 'ajax',
|
'#type' => 'ajax',
|
||||||
'#commands' => array(
|
'#commands' => array(
|
||||||
ajax_command_replace("#booking_email_default_ids_wrapper", $output_html),
|
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.
|
// This will call the command bookingEmailIDs in our custom JS file.
|
||||||
array('command' => 'bookingAjaxCheckboxes',
|
array('command' => 'bookingAjaxCheckboxes',
|
||||||
'formDataElement' => 'booking_email_default_ids', //name of the hidden form element that contains the json data
|
'formDataElement' => 'booking_email_default_ids', //name of the hidden form element that contains the json data
|
||||||
|
Reference in New Issue
Block a user