Announcement

Collapse
No announcement yet.

Require decimal reject fraction

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Require decimal reject fraction

    Store is using the EmporiumPlus Dimension Pricing module which strictly requires the use of decimals (not fractions) in the input field. On occasion, there have been customers that miss the message to use decimals. I'm thinking there might be a way to check what is (or isn't) entered in the field and popup an error message, but then, I'm not sure how to do it.
    Leslie Kirk
    Miva Certified Developer
    Miva Merchant Specialist since 1997
    Previously of Webs Your Way
    (aka Leslie Nord leslienord)

    Email me: [email protected]
    www.lesliekirk.com

    Follow me: X | Facebook | Pinterest

    #2
    Simple. Use HTML5 input type:

    <input type="number" name="number" step="any" />
    Bruce Golub
    Phosphor Media - "Your Success is our Business"

    Improve Your Customer Service | Get MORE Customers | Edit CSS/Javascript/HTML Easily | Make Your Site Faster | Get Indexed by Google | Free Modules | Follow Us on Facebook
    phosphormedia.com

    Comment


      #3
      Originally posted by Bruce - PhosphorMedia View Post
      Simple. Use HTML5 input type:

      <input type="number" name="number" step="any" />
      Simple, elegant, genius - except the site is still HTML 4.01 Transitional
      Leslie Kirk
      Miva Certified Developer
      Miva Merchant Specialist since 1997
      Previously of Webs Your Way
      (aka Leslie Nord leslienord)

      Email me: [email protected]
      www.lesliekirk.com

      Follow me: X | Facebook | Pinterest

      Comment


        #4
        well you know how to change that :)

        The only other way is to grab some JS to do it.

        The HTML5 methods are supported by IE10 circa browsers and up. I do not believe declared Doctype effects this (at least for IE). Give it a try since its simple.

        Bruce Golub
        Phosphor Media - "Your Success is our Business"

        Improve Your Customer Service | Get MORE Customers | Edit CSS/Javascript/HTML Easily | Make Your Site Faster | Get Indexed by Google | Free Modules | Follow Us on Facebook
        phosphormedia.com

        Comment


          #5
          Yup, I've already mentioned it to the store owner
          Leslie Kirk
          Miva Certified Developer
          Miva Merchant Specialist since 1997
          Previously of Webs Your Way
          (aka Leslie Nord leslienord)

          Email me: [email protected]
          www.lesliekirk.com

          Follow me: X | Facebook | Pinterest

          Comment


            #6
            Originally posted by Bruce - PhosphorMedia View Post
            Simple. Use HTML5 input type:

            <input type="number" name="number" step="any" />
            I'm getting a warning when trying to use something other than a whole number.
            Leslie Kirk
            Miva Certified Developer
            Miva Merchant Specialist since 1997
            Previously of Webs Your Way
            (aka Leslie Nord leslienord)

            Email me: [email protected]
            www.lesliekirk.com

            Follow me: X | Facebook | Pinterest

            Comment


              #7
              This has actually been fun to play with. This one increments in whole numbers and doesn't go below 0

              Code:
              <input name="number" type="number" id="Qtybox" step="1" min="0" placeholder="1" >
              This one increments in 1/10th steps and doesn't go below 0

              Code:
              <input name="number" type="number" id="Qtybox" step="0.1" min="0" placeholder="1" >



              Leslie Kirk
              Miva Certified Developer
              Miva Merchant Specialist since 1997
              Previously of Webs Your Way
              (aka Leslie Nord leslienord)

              Email me: [email protected]
              www.lesliekirk.com

              Follow me: X | Facebook | Pinterest

              Comment


                #8
                Two steps forward, one step back. It doesn't seem to be recognizing the amount in the field - as in not adding to the cart.

                Leslie Kirk
                Miva Certified Developer
                Miva Merchant Specialist since 1997
                Previously of Webs Your Way
                (aka Leslie Nord leslienord)

                Email me: [email protected]
                www.lesliekirk.com

                Follow me: X | Facebook | Pinterest

                Comment


                  #9
                  Woohoo. It needs the name="Quantity"

                  Code:
                  <input name="Quantity" type="number" id="Qtybox" step="1" min="0" placeholder="1" value="1">
                  Also, if you'd like the little arrows to display all the time add this bit of CSS

                  Code:
                  input[type=number]::-webkit-inner-spin-button, 
                  input[type=number]::-webkit-outer-spin-button {  
                  
                     opacity: 1;
                  
                  }
                  Leslie Kirk
                  Miva Certified Developer
                  Miva Merchant Specialist since 1997
                  Previously of Webs Your Way
                  (aka Leslie Nord leslienord)

                  Email me: [email protected]
                  www.lesliekirk.com

                  Follow me: X | Facebook | Pinterest

                  Comment


                    #10
                    Originally posted by lesliekirk View Post
                    Two steps forward, one step back. It doesn't seem to be recognizing the amount in the field - as in not adding to the cart.
                    Hmm, I don't see how using these types of HTML attributes could effect the underlying function of the name/value pair since they all work at the DOM level. So, its probably just not hooked into the emporium module.

                    BTW: we do this without a module by simply translating the decimal value on Submit (using jQuery). I'd have to remember where the hell we did that though to get a code sample, but its basically "onSubmit, get value of x, divide/multiple/etc, assigntoCGI value...continue submitting.
                    Bruce Golub
                    Phosphor Media - "Your Success is our Business"

                    Improve Your Customer Service | Get MORE Customers | Edit CSS/Javascript/HTML Easily | Make Your Site Faster | Get Indexed by Google | Free Modules | Follow Us on Facebook
                    phosphormedia.com

                    Comment

                    Working...
                    X