Topic: Validation bug for Dropdown and TextArea with pre-populated values
Jordan free asked 5 years ago
Expected behavior Text Area and Select are displayed as if untouched. Seems to work correctly for normal text input.
Actual behavior Text Area and Select are highlighted green (valid) when form is pre-populated using the patchValue and updateValueAndValidity methods for the controls.
<div class="md-form mb-5">
<textarea type="text"
id="dataGroupDescription"
mdbInput
mdbValidate
formControlName="dataGroupDescription"
class="md-textarea md-textarea-auto form-control"></textarea>
<label for="dataGroupDescription">Description of the Data Group</label>
<mdb-error *ngIf="dataGroupDescription.invalid && (dataGroupDescription.dirty || dataGroupDescription.touched)">
<span *ngIf="dataGroupDescription.errors.required">Description is required</span>
<span *ngIf="dataGroupDescription.errors.minlength">The description must be at least 20 characters</span>
<span *ngIf="dataGroupDescription.errors.maxlength">The description cannot exceed 5000 characters</span>
</mdb-error>
</div>
<div class="md-form input-group mb-5">
<mdb-select
[options]="companyList"
formControlName="company"
class="form-control"
placeholder="Choose Company"
label="Company"
mdbValidate></mdb-select>
</div>
Damian Gemza staff answered 5 years ago
Dear @Jordan
If you are not sure, if you're using our Validation in the right way, please take a look at our Validation page. There's described everything, with a lot of examples.
Best Regards,
Damian
Arkadiusz Idzikowski staff answered 5 years ago
Thank you for reporting this problem. We will take a closer look at it.
Jordan free commented 5 years ago
You are welcome. Once you have looked at it, can you please confirm whether it is actually a bug or whether I was doing something wrong.
Arkadiusz Idzikowski staff commented 5 years ago
Probably there is a bug, but we will check the components code and let you know if there is any workaround for that.
Jordan free commented 5 years ago
Ok - thanks for the update!
Damian Gemza staff commented 5 years ago
Problem with select will be resolved with the next release of MDB Angular.
We have tried to reproduce this problem on Textarea but without success.
Jordan free commented 5 years ago
Am I using the text area validation classes correctly?
FREE CONSULTATION
Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.
Answered
- ForumUser: Free
- Premium support: No
- Technology: MDB Angular
- MDB Version: 7.5.0
- Device: PC
- Browser: Chrome
- OS: Windows 10
- Provided sample code: No
- Provided link: No
Jordan free commented 5 years ago
Image upload is failing