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

Listening for any error messages #1362

Open
toplisek opened this issue Oct 1, 2021 · 0 comments
Open

Listening for any error messages #1362

toplisek opened this issue Oct 1, 2021 · 0 comments

Comments

@toplisek
Copy link

toplisek commented Oct 1, 2021

I try to listen for an error in the second field.
I have an issue it will not be added a class to the button. Is it technically possible to do this?
A button is pushed on the second element under an error but an error is under input cell. So, I try to add a new class to the button when an error arise for the second element. I have used if (input.dataset.parsleyId === '13')
`
$(document).ready(function()
{
var parsleyConfig = {
errorsContainer: function(parsleyField) {
return $('#errors');
}
};

$("form").parsley(parsleyConfig);
if (input.dataset.parsleyId === '13') {
button.setAttribute("class", "fixed-margin-button1");
}

$("form").on('submit', function(e)
{
var f = $(this);
f.parsley().validate();

if (f.parsley().isValid()) {
 alert('The form is valid');
} else {
 alert('There are validation errors');
}

e.preventDefault();

}
);
}
);
`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant