Commit 956d44b6 authored by Jelle Sebreghts's avatar Jelle Sebreghts
Browse files

Issue #1501976 by gopisundar: Pop up for error messages.

parent 4e3572e3
......@@ -148,7 +148,9 @@ function clientside_validation_admin_settings() {
'#description' => t('Default location to show the error messages.
If you choose "jQuery selector", provide a valid jQuery selector in the appropriate textfield.
If you choose "Custom function", provide the name of the custom javascript function.
This function will be given to !errorPlacement',
The function needs to be declared on the Drupal.clientsideValidation object prototype. You can find
further details in the clientside_validation.api.js file.
This function will be given to !errorPlacement.',
array(
'!errorPlacement' =>
l(t('the errorPlacement option of jQuery.validate()'), 'http://docs.jquery.com/Plugins/Validation/validate#options')
......
......@@ -8,6 +8,9 @@
* to support Clientside Validation you will have to code the javascript
* equivalent of your custom php validation rule and make it available for
* Clientside validation. Below is an example of how you would do this.
*
* The second block of code is an example of how to define a custom errorplacement function.
* You can set this option in admin/config/validation/clientside_validation
*/
//jQuery wrapper
(function ($) {
......@@ -27,6 +30,13 @@
//param is a value and not an array.
}, jQuery.format('Value must be equal to {0}'));
});
// According to this example you would fill in 'mycustomerrorplacement' for the custom
// error placement function at admin/config/validation/clientside_validation
// The declaration of this function needs to be within the attach of a Drupal behavior.
Drupal.clientsideValidation.prototype.mycustomerrorplacement = function (error, element) {
// error placement code here.
}
}
}
})(jQuery);
......@@ -306,7 +306,8 @@
break;
case 7:
validate_options.errorPlacement = function (error, element) {
window[self.forms[f].customErrorFunction](error, element);
var func = self.forms[f].customErrorFunction;
Drupal.myClientsideValidation[func](error, element);
}
break;
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment