Can I use q-input rules with a template variable

  • Hi guys
    I am a noob usinhg quasar - vueJS and I need to validate a q-input with a template variable but don’t work…
    Is this possible?
    I did a sandbox with a little example:

      <q-page class="flex flex-center">
        <q-form class="q-gutter-md">
              (val) => !!val || 'This field is required',
              (val) => !falgs.flag1 || 'The flag1 must be activaed'
            :rules="[(val) => !!val || 'This field is required']"
    export default {
      name: 'PageIndex',
      data() {
        return {
          text1: '',
          text2: '',
          flags: {
            flag1: false,
            flag2: false

  • (val) => flags.flag1 || ‘The flag1 must be activated’

    Pretty sure this is what you are going for right? You misspelled flags (and “activated”, btw), and putting !flags means that you satisfy the validation condition when flag1 is false.

Log in to reply