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 clean modal form after submit?

    Help
    3
    4
    1464
    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.
    • R
      renzo last edited by

      Hi there,

      Scenario:
      I have a register button, I click on it and it shows up a modal with a registration form. I submit my form and then modal is closed. If I click on register button again my form fields won’t be cleaned.

      Well, ok. I know modal is reusable. But how could I reset it at once after submit? Is there any easy way to do that?

      1 Reply Last reply Reply Quote 0
      • metalsadman
        metalsadman last edited by

        clear the models…

        1 Reply Last reply Reply Quote 0
        • G
          gestionarlaweb last edited by

          Mírate esto
          https://developer.mozilla.org/es/docs/Web/JavaScript/Referencia/Objetos_globales/Object/assign

          1 Reply Last reply Reply Quote 1
          • metalsadman
            metalsadman last edited by metalsadman

            well you should re-initialize your form modal models. ie.

            const myForm = () => { return  { name: '', password: '' } }
            ...
            data () {
              ...
              formData: myForm()
            ...
            methods: {
            ...
               onModalClose () {
                // call this function after modal close or successful submit etc..
                // to re-init formdata
                 this.formData = myForm()
            ....
            
            1 Reply Last reply Reply Quote 1
            • First post
              Last post