Vuelidate: Validation message shows already on page load

Created on 8 May 2017  路  1Comment  路  Source: vuelidate/vuelidate

The examples I see on https://monterail.github.io/vuelidate/ show that validation messages are added like this, for example:

<p v-if="!$v.text.required">Text is required</p>

But then on initial page load, the validation message already is shown. See this fiddle:

https://jsfiddle.net/b5v4faqf/97/

Is this the right way of displaying the validation messages, or should the message be wrapped in an extra condition so that it only is visible when the field has been touched? For example:

<div v-if="$v.text.$error">
    <p v-if="!$v.text.required">Text is required</p>
</div> 

Thanks.

Most helpful comment

This is the proper way to do it yes. Wrap all your errors in a container with a check on $error

>All comments

This is the proper way to do it yes. Wrap all your errors in a container with a check on $error

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ecmel picture ecmel  路  3Comments

hackuun picture hackuun  路  4Comments

jess8bit picture jess8bit  路  3Comments

muchacho-diesel picture muchacho-diesel  路  4Comments

jfis picture jfis  路  3Comments