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

    What's the proper way to use a `q-modal-layout` with a `<div slot="footer">` along with a form tag?

    Framework
    5
    16
    1653
    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.
    • T
      toymachiner62 last edited by

      I’m trying to create a modal using q-modal-layout and I want the modal to have a <form> tag and I want the submit button to be in the <div slot="footer">.

      If i use a <form> tag between the q-modal-layout and the <div slot="footer"> it breaks the footer layout and it’s now on the top of my modal rather than the bottom.

      What’s the proper way to use a q-modal-layout and <div slot="footer"> along with a <form> tag?

      0_1542407680881_94eb63af-9cb5-42fa-a160-9654e0bf2f3c-image.png

      This breaks the footer buttons and moves them to the top

      0_1542407711459_80a4ba27-717d-4b62-a29d-4d71a8c623de-image.png

      1 Reply Last reply Reply Quote 0
      • s.molinari
        s.molinari last edited by

        Where is your other content? How about adding the content above the footer slotted content?

        Scott

        1 Reply Last reply Reply Quote 0
        • T
          toymachiner62 last edited by toymachiner62

          If i do that the footer still doesn’t stick to the bottom of the modal as it’s supposed to when using q-modal-layout on a smaller window

          1 Reply Last reply Reply Quote 0
          • s.molinari
            s.molinari last edited by

            Well, without the whole code, it’s hard to help. Try to create a fiddle. Then we can look at it together.

            https://jsfiddle.net/rstoenescu/waugrryy/

            Scott

            1 Reply Last reply Reply Quote 0
            • T
              toymachiner62 last edited by

              Ok here you go https://jsfiddle.net/suhn9gpr/

              Shrink your browser up enough so that the modal scrolls, but is not maximized. Notice how the red bottom is not stuck to the bottom of the modal.

              Then go ahead and remove the <form> tag and notice how the red bottom sticks to the bottom of the modal as expected.

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

                form is native and has its own thing in the dom, can you not move the submit button or the footer slot out of the form tag? otherwise you’ll have to do some css tricks to make it right imo. usually i wrap form elements with form tag so in mobile the next button appears for input elements, then just have a button for submitting the form data which is a model containing the props for each form inputs i wanted to send in my backend.

                1 Reply Last reply Reply Quote 0
                • s.molinari
                  s.molinari last edited by

                  Yes. And with Vue, you don’t need the form tag for submitting the form data to the server. At most, you need it for accessibility.

                  Scott

                  1 Reply Last reply Reply Quote 0
                  • T
                    toymachiner62 last edited by

                    Exactly. So is quasar promoting not doing things correctly and breaking accessibility? Using form tags helps a lot of things including using the enter key to submit a form. There’s obvious “hacks” including capturing key bindings to submit forms, etc. but IMO this is not the correct way to do things.

                    If quasar is not going to address this i guess i’ll have to not use the form and capture key bindings, but it’s my suggestion/recommendation to address things like this in the quasar framework. Vue doesn’t promote this behavior and neither should quasar.

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

                      I use form tag a lot too (as means of accessibility) and have to be mindful where to put them since it usually breaks the quasar component styling. maybe you can put a feature request for this in their github page.

                      1 Reply Last reply Reply Quote 1
                      • s.molinari
                        s.molinari last edited by

                        Btw, your fiddle works perfectly for me in both FF and Chrome. The red footer stays at the bottom, no matter what I do with screen size, even when using the minimized prop.

                        Scott

                        T 1 Reply Last reply Reply Quote 0
                        • T
                          toymachiner62 @s.molinari last edited by

                          @s-molinari The difference is what scrolls. WIth form tag the entire modal scrolls. Without form tag, footer is a sticky footer in the modal and the rest of the content scrolls

                          0_1543182274867_f7085148-66d0-4c14-a697-60faecc9b7a7-image.png

                          0_1543182377957_a89cc55a-1550-4820-9674-4f0047dda494-image.png

                          1 Reply Last reply Reply Quote 0
                          • s.molinari
                            s.molinari last edited by

                            Ah. Ok. That is a different problem than what was described originally.

                            Maybe @rstoenescu can make a suggestion.

                            Scott

                            1 Reply Last reply Reply Quote 0
                            • Z
                              zeidanbm last edited by

                              I think this is a css problem and doesn’t have to do anything with quasar. check this codepen (https://codepen.io/zeidanbm/pen/wQEjBB)
                              The trick is to use flexbox to style it and make sure no scroll is set on parent while wrapper child will have scroll.

                              1 Reply Last reply Reply Quote 1
                              • rstoenescu
                                rstoenescu Admin last edited by

                                Way to do it: https://jsfiddle.net/rstoenescu/sza3qncg/4/

                                Few comments:

                                1. Quoting you: “So is quasar promoting not doing things correctly and breaking accessibility?” and “my suggestion/recommendation to address things like this in the quasar framework” --> No, Quasar was actually the first Vue framework working on accessibility. We take great pride in the components being accessible.

                                2. This confusion of yours comes from the fact that you are misunderstanding the concept of a slot. You’re using slot=“footer” yet you wrap it with a DOM element (<form>). Slots are strictly connected to the component upon which you are using them, and it’s equivalent to saying: “hey, component X, this slot needs this content” then the component fills its own template (not your template!) with the indicated slot content. So, wrapping a slot with an element makes no sense… because it’s a slot, it’s not content that you can wrap or place in a specific DOM tree of your choosing for the component — the component decides where to put it.

                                3. Finally, some thing that you should be aware of regarding your comment “Vue doesn’t promote this behavior and neither should quasar”: You are operating with Vue components, not native form elements. <form> is designed for native form elements. In any case, this is not to be taken as "Quasar components don’t work with <form>", because QInput, QButton (which actually even has a “type” prop: submit, reset, …), … do work. But just be aware these are components, not native form elements.

                                -Razvan

                                1 Reply Last reply Reply Quote 2
                                • s.molinari
                                  s.molinari last edited by s.molinari

                                  Oh brother. Why didn’t I think of putting the layout in the form element…feeling stupid. 😄

                                  Scott

                                  1 Reply Last reply Reply Quote 0
                                  • T
                                    toymachiner62 last edited by

                                    🤦🏻♂ That makes 2 of us @s-molinari

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