function webform_client_form_validate in Webform 6.3
Same name and namespace in other branches
- 5.2 webform.module \webform_client_form_validate()
- 5 webform.module \webform_client_form_validate()
- 6.2 webform.module \webform_client_form_validate()
- 7.4 webform.module \webform_client_form_validate()
- 7.3 webform.module \webform_client_form_validate()
1 string reference to 'webform_client_form_validate'
- webform_client_form in ./
webform.module - Client form generation function. If this is displaying an existing submission, pass in the $submission variable with the contents of the submission to be displayed.
File
- ./
webform.module, line 2099
Code
function webform_client_form_validate($form, &$form_state) {
$node = node_load($form_state['values']['details']['nid']);
$finished = $form_state['values']['details']['finished'];
// Check that the submissions have not exceeded the total submission limit.
if ($node->webform['total_submit_limit'] != -1) {
module_load_include('inc', 'webform', 'includes/webform.submissions');
// Check if the total number of entries was reached before the user submitted
// the form.
if (!$finished && ($total_limit_exceeded = _webform_submission_total_limit_check($node))) {
// Show the user the limit has exceeded.
theme('webform_view_messages', $node, 0, 1, 0, NULL, $total_limit_exceeded, array_keys(user_roles()), FALSE, FALSE);
form_set_error('', NULL);
return;
}
}
// Check that the user has not exceeded the submission limit.
// This usually will only apply to anonymous users when the page cache is
// enabled, because they may submit the form even if they do not have access.
if ($node->webform['submit_limit'] != -1) {
// -1: Submissions are never throttled.
module_load_include('inc', 'webform', 'includes/webform.submissions');
if (!$finished && ($user_limit_exceeded = _webform_submission_user_limit_check($node))) {
// Assume that webform_view_messages will print out the necessary message,
// then stop the processing of the form with an empty form error.
theme('webform_view_messages', $node, 0, 1, 0, $user_limit_exceeded, NULL, array_keys(user_roles()), FALSE, FALSE);
form_set_error('', NULL);
return;
}
}
// Run all #element_validate and #required checks. These are skipped initially
// by setting #validated = TRUE on all components when they are added.
_webform_client_form_validate($form, $form_state);
}