3 Replies Latest reply on Jun 14, 2015 9:55 AM by simonpcooper

    Email Validation

    hrcap

      Title

      Email Validation

      Post

           Hi Guys

            

            have a script to check for an '@' sign within an email address

            

           my if statement is:

            

            
           PatternCount (EMPLOYEES::email_work ; "@") = 0
            
            
           how would i add to this if statement to get the email address to turn red in the event that there is not '@' sign present?
            
            
           Many Thanks
            
            
           Hadleigh

        • 1. Re: Email Validation
          schamblee

               Use Auto-Enter calculated value with the following calculation

               If(PatternCount(Self;"@")=0;TextColor(Self;RGB(255;0;0));TextColor(Self;RGB(0;0;0)))

               then uncheck "Do not replace existing value of (if any)"

          • 2. Re: Email Validation
            hrcap

                 Thanks Chamblee that worked perfectly,

                  

                 one last question if you dont mind...

                  

                 How would i add to that validation calculation to get the email to turn red if there was not at least one period '.' in it?

                  

                 I tried adding...

                  

                 or If(PatternCount(Self;".")<1;TextColor(Self;RGB(255;0;0));TextFormatRemove(Self));

                  

                 to your calculation but this did not work

                  

                  

                 cheers

            • 3. Re: Email Validation
              simonpcooper

              Try this to check for the period, invalid results will show in red:

              If(

              PatternCount(Self;"@")<>1

              or

              PatternCount(Self;".")=0
              ;

              TextColor(Self;RGB(255;0;0));

              TextColor(Self;RGB(0;0;0)))