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

Comment form errors are not shown for bootstrap > 3 #129

Open
ephes opened this issue Oct 15, 2023 · 0 comments
Open

Comment form errors are not shown for bootstrap > 3 #129

ephes opened this issue Oct 15, 2023 · 0 comments

Comments

@ephes
Copy link

ephes commented Oct 15, 2023

Hi,

thanks for this cool project! I'm using it for my Python Podcast site for example and it works great. But yesterday I got a complaint that the comments were not working. The problem was that the error messages for the comment form were not shown. And this was caused by me using bootstrap > 3 😬. There's some code in ajaxcomments.js modifying the classes to remove the display: none added by default to an element having the invalid-feedback class:

                $field.after('<span class="js-errors">' + data.errors[field_name] + '</span>');
                $field.closest('.control-group').addClass('error');  // Bootstrap 2
                $field.closest('.form-group').addClass('has-error'); // Bootstrap 3

Maybe it's possible to add a line for Bootstrap 4 and 5, too? This line here might be enough:

$field.removeClass('is-valid').addClass('is-invalid');

And the structure of the html has to be modified a little bit so that the error span is a direct silbling of the input field.

I just add a small css workaround for my own projects so it's not super important. Have a nice day!

best regards
Jochen

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