I have a button that is meant to be disabled before all validation requirements are met. However the button is disabled only when I click it the first time and allow the validation errors to show up. I would like my button to be disabled from the beginning until all inputs are entered accordingly. Can someone assist with this, please?
Form component
<template>
<div class="form-wrapper">
<form @submit.prevent="handleSubmit(sendFormData)" novalidate>
<slot name="form-content"/>
<slot name="button-submit" :is-invalid="isInvalid"/>
</form>
</div>
</template>
inputs component (only showing the button section for this part):
<template #button-submit="{isInvalid}">
<button :disabled="isInvalid && !selectedTown"
:class="{'button-main-disabled': isInvalid && !selectedTown}"
type="submit"
class="button-main button-add">
School toevoegen
</button>
</template>