Validation bug for Dropdown and TextArea with pre-populated


Topic: Validation bug for Dropdown and TextArea with pre-populated values

Jordan pro premium priority asked 2 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>

Jordan pro premium priority commented 2 years ago

Image upload is failing


Arkadiusz Idzikowski staff answered 2 years ago

Thank you for reporting this problem. We will take a closer look at it.


Jordan pro premium priority commented 2 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 2 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 pro premium priority commented 2 years ago

Ok - thanks for the update!


Damian Gemza staff commented 2 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 pro premium priority commented 2 years ago

Am I using the text area validation classes correctly?


Damian Gemza staff answered 2 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


Please insert min. 20 characters.