No More Posting New Topics!

If you have a question or an issue, please start a thread in our Github Discussions Forum.
This forum is closed for new threads/ topics.

Navigation

    Quasar Framework

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search

    How to validate input that lives in a child component

    Help
    1
    2
    932
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • J
      johnboy last edited by johnboy

      Setup

      • I have a form which is contains three q-inputs, each of which lives in a seprate child component (for reusability).
      • Each input is using internal validation with a ‘required’ rule.
      • Each input has a ref.
      • One of the inputs has a popup proxy with a date picker

      Issue

      • The date picker validation does not fire if the field is empty. That is when validating the form via this.$refs.form.validate() the validation returns success, even though the date picker input does not have a value.

      I am looking for a way to call validate() on the date picker input. I have tried this.$refs.refName.validate() but this return validate is not a function. Is this because it sits as a child component?

      Note: I can focus the date picker input using this.$refs.dueDate.$el.focus()

      Any help appreciated.

      1 Reply Last reply Reply Quote 0
      • J
        johnboy last edited by

        Solved. For those interested, this section of the Vue documentation provides the solution: https://vuejs.org/v2/guide/components-edge-cases.html#Accessing-Child-Component-Instances-amp-Child-Elements

        1 Reply Last reply Reply Quote 0
        • First post
          Last post