New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Element error message position #226
Comments
Thanks |
I could not find this on the docs neither, please add :) |
The solution based on "INPUT-ELEMENT_err_msg" feels rather implicit, it should be considered deprecated and will probably be removed in the future. There are two different ways to specify where an error message should appear. Either you use the attribute All this is described on http://formvalidator.net/#configuration_position |
It's simpler than assigning data-validation-error-msg-container for each element. The other option would be to allow writing a function on "errorMessagePosition" as "function(element)" in order to allow a predictable (but not common) behavior. This because it's always better to write where the message will be just once than on every single input. |
Letting the |
The same callback solution should be implemented for help text positioning. |
This will change a bit. This is how the implementation will look config.inlineErrorMessageCallback = function($input, errorMessage, config) {
// Return an element that should contain the error message.
// This callback will called when validateOnBlur is set to true (default) and/or errorMessagePosition is set to 'inline'
};
config.submitErrorMessageCallback = function($form, errorMessages, config) {
// Return an element that should contain all error messages.
// This callback will be called when errorMessagePosition is set to 'top'
}; This change will also deprecate config.inlineErrorMessageCallback = function($input, errorMessage, config) {
if (errorMessage) {
customDisplayInlineErrorMessage($input, errorMessage);
} else {
customRemoveInlineError($input);
}
return false; // prevent default behaviour
};
config.submitErrorMessageCallback = function($form, errorMessages, config) {
if (errorMessages) {
customDisplayErrorMessagesInTopOfForm($form, errorMessages);
} else {
customRemoveErrorMessagesInTopOfForm($form);
}
return false; // prevent default behaviour
}; This means that Notice that the default configuration uses |
Now element error message goes to:
...
How to send element error message to my own div (example: div class="my-error").
This div have all elements of the form.
The text was updated successfully, but these errors were encountered: