Vue-form-generator: If a checklist or select is required it's not processed in the validation

Created on 6 Apr 2018  路  4Comments  路  Source: vue-generators/vue-form-generator

Current :

When a select or a checklist is required and if nothing is checked / selected, the @validated isValid value is true and no error message is displayed.

Expected :

The isValid should be setted to false and error should contain the errors, and some error message should appear bellow saying that it's required.

bug enhancement easy

All 4 comments

I found a work arround but i don't understand why it wasn't made to work like the other fields.

So to have the required state checked :

  • for the checklist you have to use
    javascript min: 1, validator: VueFormGenerator.validators.array,
  • for the select you have to use
    javascript min: 1, validator: VueFormGenerator.validators.string,

The problem is that the required validator is a bit "simple", in that it only checks if the value being passed in isNil (null || undefined) or is an empty string. An empty array is neither of these, and so passes the required validation.

We can probably make the required validator a bit more intelligent... where it can check to see if the value being passed in is an array, and if so, test it's length.

pls.. fixed the bug.

I so sorry.
I solved problem.
I model set selectedId:0. changed model set selectedId:''.

I have to take a break. 馃槴

Thanks for your help. 馃憤
Thanks for your library. 馃憤

Was this page helpful?
0 / 5 - 0 ratings

Related issues

sjordan1975 picture sjordan1975  路  5Comments

icetee picture icetee  路  4Comments

sjordan1975 picture sjordan1975  路  5Comments

lionel-bijaoui picture lionel-bijaoui  路  5Comments

LouWii picture LouWii  路  4Comments