| 6 ahah_example_simple_validation.inc | ahah_example_simple_validation_callback() |
Callback for autocheckboxes. Process the form with the number of checkboxes we want to provide.
1 string reference to 'ahah_example_simple_validation_callback'
File
- ahah_example/
ahah_example_simple_validation.inc, line 65 - Demonstrate validation of a textfield using AHAH. This approach allows 'live' validation of a field which degrades gracefully when JavaScript is not available.
Code
function ahah_example_simple_validation_callback() {
$form = ahah_example_callback_helper();
// This section prepares the actual output that will be returned to the
// browser.
$selected_portion = $form['wrapper_fieldset']['two_words_required'];
// To avoid doubling-up the wrapper, we have to remove it here.
unset($selected_portion['#prefix'], $selected_portion['#suffix']);
// Now render and output.
$output = drupal_render($selected_portion);
// Include (optionally) the results of any drupal_set_message() calls that
// may have occurred.
$output .= theme('status_messages');
// Output the results and exit.
drupal_json(array('status' => TRUE, 'data' => $output));
exit();
}
Login or register to post comments