rules: float type verification but not required
-
Hello,
I would like to check my float field without making it required.
I manage to check its type but as soon as I do not inform it it puts me an error.<q-input filled v-model.number="valeur" label="Valeur" type="number" step="any" :rules="[champDecimal()]" /> methods: { champDecimal () { return (v) => /^([0-9]+([.][0-9]*)?|[.][0-9]+)$/.test(v) || 'Valeur erronée' } }
Edit: I tested the regex below to allow the empty chain but it does not work.
^([0-9]+([.][0-9]*)?|[.][0-9]+)$|^$