this.$refs.input.validate(...).then is not a function" the use input validate method



  • hej

    Then I use quasar validate method everything is working, but I have error:

    this.$refs.input.validate(...).then is not a function
    

    my code

            <q-input
              v-model="accountData.Company.subdomain"
              outlined
              color="secondary"
              label-color="grey"
              :label="$t('wizzard.subdomain')"
              :placeholder="$t('wizzard.ex: company name')"
              class="inputField inputField__input-domain"
              type="text"
              :rules="[val => validation.requireRule(val), val => validation.noUppearCaseRule(val), val => validation.domainNoExistRule(accountData.Company), val => validation.noSpecialCharRule(val)]"
              lazy-rules
              ref="domainInput"
              @input="validate"
            >
             ...
    
                validate(val: boolean): void {
               (this.$refs.domainInput as any & { validate: () => boolean }).validate().then((res: boolean) => { this.isValid = res;});
             }   
    

    Why it occured? I try to fix it, but I don’t know how.



  • @Ewa If you put ref="domainInput" you should call this.$refs.domainInput.validate and not this.$refs.input.validate(...)



  • @turigeza , Good point, but I do some mistake then I created post. In my console I have error

    this.$refs.domainInput.validate(…).then is not a function

    But, this error still occure.



  • hej, noone could help?



  • @Ewa make a codepen.


Log in to reply