Skip to content
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

prompt and placeholder #833

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 18 additions & 8 deletions js/jquery.validationEngine.js
Original file line number Diff line number Diff line change
Expand Up @@ -915,11 +915,9 @@
default:
var field_val = $.trim( field.val() );
var dv_placeholder = $.trim( field.attr("data-validation-placeholder") );
var placeholder = $.trim( field.attr("placeholder") );
if (
( !field_val )
|| ( dv_placeholder && field_val == dv_placeholder )
|| ( placeholder && field_val == placeholder )
) {
return options.allrules[rules[i]].alertText;
}
Expand Down Expand Up @@ -1716,12 +1714,24 @@
* field
*/
_closePrompt: function(field) {
var prompt = methods._getPrompt(field);
if (prompt)
prompt.fadeTo("fast", 0, function() {
prompt.parent('.formErrorOuter').remove();
prompt.remove();
});
var prompt = methods._getPrompt(field);

var form = $(field).closest('form, .validationEngineContainer');
var options = form.data('jqv');
var useFade = options ? options.useFadeOnClosePrompt : true;
if (prompt) {
var removePrompt = function(){
prompt.parent('.formErrorOuter').remove();
prompt.remove();
}

if (useFade) {
prompt.fadeTo("fast", 0, removePrompt);
} else {
removePrompt();
}
}

},
closePrompt: function(field) {
return methods._closePrompt(field);
Expand Down