Announcement

Collapse
No announcement yet.

Valid phone number required

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

    Valid phone number required

    I am having a hard time figuring out how to get javascript to work with the miva code. When people are checking out, I would like it to make sure that a valid phone number was entered. Since I am at it, maybe getting it to validate the email as well. :)

    Thank you!!! :D

    #2
    Re: Valid phone number required

    I believe the only way to do this (without a custom module) would be with JavaScript, but I wouldn't rely on this validation. Also, you are probably going to annoy more customers than anything.

    If you're still interested, look for some tutorials on google about form onsubmit.

    Comment


      #3
      Re: Valid phone number required

      I have found a way to use the javascript, but I don't know how it works with Miva.

      Here is the Miva Code:
      HTML Code:
      <td align="left" valign="middle">
      <mvt:item name="fonts" param="body_font">
      <input type="text" name="ShipPhone" size=25 value="&mvte:global:ShipPhone;">
      </mvt:item>
      </td>
      And the Javascript:
      HTML Code:
      <form name="Form1"  onsubmit="return FormValidate()">
              <input type="text" size="25" name="PhoneNumber" />
              <br /><br />
            <input type="submit" value="Submit" />
          </form>
      The script code:
      HTML Code:
      <script type="text/javascript">
              function FormValidate()
              {
         if(document.Form1.PhoneNumber.value.search(/\d{3}\-\d{3}\-\d{4}/)==-1)
         {
            alert("The phone number you entered is not valid.\r\nPlease enter a phone number with the format xxx-xxx-xxxx.");
            return false;
         }
      }
      </script>
      Is it possible to get all of this to work together on the Miva Customer Information page?

      Comment


        #4
        Re: Valid phone number required

        Keep in mind that this validation will only work for 10-digit US and Canadian phone numbers in the format XXX-XXX-XXXX. If you ship internationally, your customers will not be able to enter their (valid) phone numbers. Even US or Canadian customers may run into problems if they enter the phone with the "1" prefix (very common) or use brackets to surround the area code, etc.

        While you could write a much more elaborate Javascript to account for various US/Canada ways of writing down phone numbers, trying to account for every international format is going to be next to impossible. All in all this is really a pointless exercise as you will get a number of people who would rather abandon their carts than try to figure out how to enter their phone numbers "your way." Make it easier for the customer to check out, not more difficult.

        Comment


          #5
          Re: Valid phone number required

          oh...ok. Thank you very much for that information!

          Comment


            #6
            Re: Valid phone number required

            And even if you did validate it, how would you fight against my favorite phone number, (911)555-1212?

            Comment


              #7
              Re: Valid phone number required

              :) Very true. We were just hoping to discourage people from leaving numbers like our most recent customer. He left us 55555556555. So maybe what I really need is to figure out how to make the one big box into 3 smaller boxes. I tried doing that but the miva code isn't making any sense to me.
              <input type="text" name="ShipPhone" size=25 value="&mvte:global:ShipPhone;">

              Comment


                #8
                Re: Valid phone number required

                Again, that's really just going to annoy customers more than anything. Are you just trying to get them to enter a formated number? You can put text next to the box that says "recommended format (###)###-####" or use JavaScript onsubmit to format the number (similar to what you posted above).

                Comment


                  #9
                  Re: Valid phone number required

                  that wont do a thing to prevent fake numbers. people who don't want to leave phone numbers wont. (Personally I don't, but I do double check my email address).

                  Basically, live with it and learn to rely on email. Much more efficient from your point of view anyway.
                  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


                    #10
                    Re: Valid phone number required

                    Along these same lines, is there a way to make the phone number a required field without resorting to javascript?

                    Comment


                      #11
                      Re: Valid phone number required

                      Yes, its in the admin under Stores > Your Stores > Customer Fields...however, *** I STRONGLY DISCOURAGE ANYONE FROM REQUIRING A PHONE NUMBER *** Its rather pointless. If I want to give it to you fine, but don't require it.
                      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


                        #12
                        Re: Valid phone number required

                        Thanks Bruce, I'll see if I can talk my client out of it... I'm inclined to agree with you but the shipping department wants it for UPS and stuff like that.

                        Comment


                          #13
                          Re: Valid phone number required

                          ??? What's the shipping dept going to do with 206 555 1212? Don't they have clocks?

                          BTW: UPS Doesn't need a phone number...and "stuff like that" is why I don't give out mine # when ordering online.
                          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


                            #14
                            Re: Valid phone number required

                            Too bad I can't sic you on the shipping dept bruce ;) Ok, I'll put up the good fight and see if I can't derail this request!

                            Comment


                              #15
                              Re: Valid phone number required

                              Originally posted by alyanm
                              Along these same lines, is there a way to make the phone number a required field without resorting to javascript?
                              Yes,
                              Goto your administration and click on your store name.
                              Then choose Customer Fields and there you can set any of the fields you want to Hidden , Required, or Optional

                              Good Luck,
                              Michael
                              Michael Moyers
                              Owner/Administrator of Just Rite Design
                              A growing network of professionals in web design, ecommerce solutions, graphic design, and audio/video productions.
                              Please contact me for more information.

                              Comment

                              Working...
                              X