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

    Form Component in Qdialog

    Help
    2
    3
    917
    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.
    • M
      mecjos last edited by

      I use a form component in qdialog and in form component I have submit and cancel button… How can I close the dialog from form component. It’s not globally declared.

      <q-dialog v-model="formDialog" persistent ref="projectForm">
            <q-card style="width: 700px; max-width: 80vw;">
              <q-toolbar class="q-pa-md">
                <q-icon name="work" size="md" class="text-primary"/>
                <q-toolbar-title>{{ formTitle }}</q-toolbar-title>
                <q-btn flat round dense icon="close" v-close-popup />
              </q-toolbar>
              <q-separator />
              <q-card-section>
                <project-form :customerId="customerId" :selectedItem="selectedItem" :customers="pageContent.customers"></project-form>
              </q-card-section>
            </q-card>
          </q-dialog>
      
      1 Reply Last reply Reply Quote 0
      • J
        jraez last edited by jraez

        You have to trigger an event on you form component

        onSubmit() {
         // validation & stuff
        this.$emit('submit_or_whatever',  { ... });  
        }
        

        And catch it into your dialog

          <project-form :customerId="customerId" :selectedItem="selectedItem" :customers="pageContent.customers" @submit_or_whatever="onSubmitorWhatever" ></project-form>
        

        In your dialog component:

        methods:  {
         onSubmitOrWhatever (playload) {
           this.formDialog = false
         }
        }
        
        1 Reply Last reply Reply Quote 1
        • M
          mecjos last edited by

          Thank you… I thought more complicated 🙂 that’s right and worked.

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