Navigation

    Quasar Framework

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

    How to offer an input for only positive numbers without validation?

    Useful Tips (NEW)
    faq-ui
    4
    7
    461
    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.
    • s.molinari
      s.molinari last edited by

      Hi,

      I thought this might be useful for others. It’s a way to create a QInput, which will only take positive numbers.

      https://codepen.io/smolinari/pen/gOYyjKp

      Scott

      patryckx qyloxe 2 Replies Last reply Reply Quote 0
      • patryckx
        patryckx @s.molinari last edited by patryckx

        @s-molinari What is the best solution for currency formatting?
        Natively Quasar doesn’t have a solution yet?
        I need to accept values like $ 100,00 / $ 1000,00 / $ 10.000,00

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

          @s-molinari - paste from clipboard 🙂

          e226e1e9-15e9-43fa-a5c0-18b5d853a43e-image.png

          OK, I know, after loosing focus it changes to 0 🙂

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

            And you can still also have a validation rule, which you should have.

            Scott

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

              @patryckx check my sandbox currency formatter, you can replace the characters for ., prolly tweak the regular expression too. Its at src/components/base… https://codesandbox.io/s/0ybb3 sry cant check atm in mobile. mosuforge also has one using https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/NumberFormat

              patryckx 1 Reply Last reply Reply Quote 3
              • patryckx
                patryckx @metalsadman last edited by

                @metalsadman Thank you, I will check because I have this need in a project.
                I have old solutions, but I don’t know if they are so efficient.

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

                  @patryckx you can see output here https://0ybb3.sse.codesandbox.io/form-validations/external-vuelidate amount field, he also helped me on how i can use numeric pad on this in mobile.

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