Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

API CHANGE Removed FormResponse handling for erroneous ajax requests …

…in Form->validate(), use javascript validation instead, or reload the whole form with new HTML including the error messages
  • Loading branch information...
commit c2339d218115984ac38eabcad4b9e02d87794324 1 parent 85a331c
@chillu chillu authored
Showing with 4 additions and 17 deletions.
  1. +4 −17 forms/Form.php
View
21 forms/Form.php
@@ -1015,23 +1015,10 @@ function validate(){
$errors = $this->validator->validate();
if($errors){
- if(Director::is_ajax() && $this->validator->getJavascriptValidationHandler() == 'prototype') {
- FormResponse::status_message(_t('Form.VALIDATIONFAILED', 'Validation failed'), 'bad');
- foreach($errors as $error) {
- FormResponse::add(sprintf(
- "validationError('%s', '%s', '%s');\n",
- Convert::raw2js($error['fieldName']),
- Convert::raw2js($error['message']),
- Convert::raw2js($error['messageType'])
- ));
- }
- } else {
- $data = $this->getData();
-
- // Load errors into session and post back
- Session::set("FormInfo.{$this->FormName()}.errors", $errors);
- Session::set("FormInfo.{$this->FormName()}.data", $data);
- }
+ // Load errors into session and post back
+ $data = $this->getData();
+ Session::set("FormInfo.{$this->FormName()}.errors", $errors);
+ Session::set("FormInfo.{$this->FormName()}.data", $data);
return false;
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.