Open farhanmasud opened 2 years ago
Hello @farhanmasud, clearly this problem results from the bootstrap conflicts. clearly Django does not load the bootstrap 3 CSS files on this page because crispy is using bootstrap4. I've figured out a fix for it and that is if i would kindly be assigned the issue.
@nnabuihe-favour thanks for checking out the issue. Please discuss with @2ynn and @tristanlatr to get this issue assigned to you.
Hi @nnabuihe-favour,
Please go ahead if you know how to handle this issue. But please write a complete description of what you have changed in the PR description :)
Thanks a lot!
This front-end HTML template currently uses bootstrap v3 and in the settings file, the
CRISPY_TEMPLATE_PACK
variable is currently set to'bootstrap4'
.bootstrap4
template pack of django-crispy-forms uses the CSS classinvalid-feedback
for rendering error messages under a field which doesn't exist in bootstrap v3. Bootstrap v3 uses the CSS classhelp-block
for rendering the error messages instead.As the templates use bootstrap v3, when django-crispy-forms with
'bootstrap4'
template pack is rendering error message withinvalid-feedback
CSS class, it's not displaying with the CSS styling required to show the error messages [for example, red color for font].This came up while implementing the validations for phone field with as mentioned on #116 with django-phone-field on the
Property
model. Example screenshot provided below -Here the error message
Only E164 numbers are supported here (+12223334444).
shows up in bold black text which was supposed to be in CSS classes to show errors in red font. Here the bootstrap4 class applied isinvalid-feedback
but since bootstrap3 doesn't come with this class, it's not showing up.If I change the
CRISPY_TEMPLATE_PACK
variable tobootstrap3
, it breaks the form, it's unable to render the two fields correctly that are inPhoneField
. This particular case might be related to a different issue but I'm noting it here to demonstrate this particular scenario.