How to check child components for errors?
-
Hi,
i have a QStepper with 3 QSteps. Each QStep has a few QInput. I want to set :error on a QStep if any of his child QInputs has an error for example a required field is missing.How to to this?
I have code like this (this is the template in PUG):
qstep(:error= hasStepError) .col-12.q-pa-sm q-input.col-12.q-pa-sm(:rules="[val => !!val || 'Field is required']" :label='Label' )
This hasStepError is a boolean field in data():
data() { return { hasStepError: false,
So when hasStepError is true i get the error icon on the step - how i want it
But now how can i change this hasStepError when one of the child components has an error?
I have tried adding an eventlistener on the QInput like this: @input=‘onInput($event)’ but in $event i get the value not the components so i cannot check if it has an error.
-
I saw QForm and QForm has an event @validation-error if any of his inner QInputs has an error but my GUI expects an save button on the end of the whole QStepper so this seems not quite feasible.