Topic: Validation error width on Inputs/TextAreas squishes text

matt2 pro asked 9 years ago


I'm running into an issue where the validation label's width is limited to the width of the input label. Screen shots: Squished Text Normal Text In order to fix this, we're adding:
.md-form {
  label {
    width: 100%;
  }
}

Marta Wierzbicka free answered 9 years ago


Hi, Yeah, your solution is much better, so once again thanks for sharing. Best, Marta

matt2 pro answered 9 years ago


Might want to do something more targeted, like selecting the label with the data-error attribute.
.md-form label[data-error] {
  width: 100%
}
This way you won't have to append a class to every validating input.

Marta Wierzbicka free answered 9 years ago


Hi Guys, about the class, you mean sth like this: CSS:
.full-width.md-form label {
  width: 100%;
}
And then I add class .full-width and for this error width of validation label will be 100% and without this class width will be auto:
<div class="md-form full-width">
    <input type="text" name="username" class="form-control invalid text" id="frm-form-username">
    <label data-error="Not valid lorem ipsum dolor sitam" for="frm-form-username">Username</label>
</div>
Best, Marta

matt2 pro answered 9 years ago


Yeah, that's likely what I'm going to do. Thanks.

johndoe pro answered 9 years ago


You could make a class for the error label that your validation plugin creates that has width 100% instead of globally setting all labels to 100%. Otherwise users with MDB 4.3.1 Pro who don't need label at 100% will need to reset it back to width auto.

matt2 pro answered 9 years ago


No problem. :) All the best. This is a great library.

Marta Wierzbicka free answered 9 years ago


Hello, Thanks for noticed this and share your solution. Best, Marta

Please insert min. 20 characters.

FREE CONSULTATION

Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.

Status

Specification of the issue

  • ForumUser: Pro
  • Premium support: No
  • Technology: General Bootstrap questions
  • MDB Version: -
  • Device: -
  • Browser: -
  • OS: -
  • Provided sample code: No
  • Provided link: No
Tags