Announcement

Collapse
No announcement yet.

Characters allowed in email address - best way to strip out bad characters?

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

    Characters allowed in email address - best way to strip out bad characters?

    Little surprised that Miva v9 still allows bogus characters to be saved in a customers email address field.

    I have a client where we are implemented some retargeting JS code and I need to pass the billing email address to the code. I'm using &mvt:global:customer:bill_email;

    But, I really want to avoid having some person put characters like {[}{;:" in the email address field and having it break the JS code being written out.

    Does anyone know if toolkit can easily strip out a list of bad characters from a variable?

    -Kevin
    Web Design and Development, Internet Marketing
    Lancer Media, Inc.

    #2
    Re: Characters allowed in email address - best way to strip out bad characters?

    And, I'm wondering now if it would be better to use &mvt:global:customer:pw_email; instead of the billing email address.

    -Kevin
    Web Design and Development, Internet Marketing
    Lancer Media, Inc.

    Comment


      #3
      Re: Characters allowed in email address - best way to strip out bad characters?

      There are many javascript/jquery widgets out there that will do email validation. This is actually better done at the DOM level so customers don't have to submit and wait and then be told something is wrong. Very easy to add to the OCST and ACAD screens.
      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


        #4
        Re: Characters allowed in email address - best way to strip out bad characters?

        You could also "clean" the email field to remove the characters you don't want:

        Code:
        <mvt:assign name="g.customer:bill_email" value="glosub(g.customer:bill_email, '{', '')" />
        <mvt:assign name="g.customer:bill_email" value="glosub(g.customer:bill_email, '}', '')" />
        <mvt:assign name="g.customer:bill_email" value="glosub(g.customer:bill_email, ';', '')" />
        Brennan Heyde
        VP Product
        Miva, Inc.
        [email protected]
        https://www.miva.com

        Comment


          #5
          Re: Characters allowed in email address - best way to strip out bad characters?

          Thanks Brennan!

          -Kevin
          Web Design and Development, Internet Marketing
          Lancer Media, Inc.

          Comment


            #6
            Re: Characters allowed in email address - best way to strip out bad characters?

            The problem with cleaning the code AFTER submission is that you are most likely going to have an email address that doesn't work. For example, lets say my email, address is:

            [email protected]

            but i fat finger it to

            my,[email protected]

            cleaning it after results in

            [email protected]

            which means the customer isn't going to get their email.
            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


              #7
              Re: Characters allowed in email address - best way to strip out bad characters?

              Originally posted by Bruce - PhosphorMedia View Post
              The problem with cleaning the code AFTER submission is that you are most likely going to have an email address that doesn't work. For example, lets say my email, address is:

              [email protected]

              but i fat finger it to

              my,[email protected]

              cleaning it after results in

              [email protected]

              which means the customer isn't going to get their email.
              I'm not planning on using this for anything other than the retargeting JS code that's being written in the HTML. And the only reason I'm asking is I don't want certain characters sneaking through like }] that could mess with the JS code on the page. Although now that I think of it....even if the JS code breaks with bad characters....that's limited to the JS code within that </script> block correct? So only that script breaks?

              In the end, it's not that big of a deal for the retargeting.....I just don't want it breaking other code on the page.

              I was just curious on ways to do this. I'd prefer Miva not allow the email fields to be saved with bad data to begin with. In the end I'm also using &mvte to encode bad characters if they are there.

              -Kevin
              Web Design and Development, Internet Marketing
              Lancer Media, Inc.

              Comment

              Working...
              X