function _handle_form_submit in Shoutbox 7.2
Same name and namespace in other branches
- 7 shoutbox.module \_handle_form_submit()
1 string reference to '_handle_form_submit'
- shoutbox_add_form in ./
shoutbox.module - Generates form for adding shouts.
File
- ./
shoutbox.module, line 623 - Shoutbox module displays a block for users to create short messages for the whole site. Uses AHAH to update the database and display content.
Code
function _handle_form_submit($form, $form_state) {
// Collect error.
$error = form_get_errors();
// Clear error for all the cases.
drupal_get_messages();
// Logic behind error.
if (!empty($error)) {
$errormsg = '';
foreach ($error as $msg) {
$errormsg .= $errormsg != '' ? '<br/>' . $msg : $msg;
}
// Java script function to process error.
$commands[] = ajax_command_invoke(NULL, "error_javascript_call");
$commands[] = ajax_command_html('#shoutbox-error', $errormsg);
$commands[] = ajax_command_invoke('#shoutbox-error', 'show');
if (module_exists('captcha')) {
//$html = render(drupal_get_form('module_captcha_form'));
//$commands[] = ajax_command_replace(".captcha", $html);
}
return array(
'#type' => 'ajax',
'#commands' => $commands,
);
//render(drupal_get_form('module_captcha_form'))
//$form['wrapper']['error_message'] = array('#markup' => '<div id="shoutbox-error" class="messages error" title="Click to close">'.$errormsg.'</div>');
//$form_state['rebuild'] = TRUE;
//return $form;
}
else {
$commands[] = ajax_command_invoke(NULL, "success_javascript_call");
//$commands[] = ajax_command_replace("#stateDiv", render($form['state']));
//$commands[] = ajax_command_replace("#load_captcha", render($form['captcha']));
return array(
'#type' => 'ajax',
'#commands' => $commands,
);
//return $form;
}
}