1 Reply Latest reply on May 11, 2011 12:03 PM by philmodjunk

    Email

    Tbear

      Title

      Email & Zip field validation question

      Post

      For FMP 11 I need a validation by calculation for "Email" that will refuse incorrect structure and I need another validation calc that will not just limit Zip to a 5 numbers max but also to a 5 number minimum. Thanks!

        • 1. Re: Email & Zip field validation question
          philmodjunk

          For the 5 digit zipcode validation: Length( Filter ( self ; 9876543210 ) ) = 5

          And email validation is a bit more complex. I've played around with this expression, but don't know if it truly traps all possible format errors:

          Let ( [ A = Trim ( self ) ; //trim off any trailing or leading spaces
                    Len = Length ( A ) ;
                    AtPos = Position ( A ; "@" ; 1 ; 1 ) ;   // find position of @ symbol
                    DotPos = Position ( A ; "." ; Len ; - 1 ) ;  // position of . nearest end of text
                    DotPosEnd = Len - DotPos
                  ] ;
                  ( AtPos > 1 ) and ( AtPos < DotPos ) and ( DotPosEnd  < 4 ) and ( DotPosEnd > 1 ) and ( PatternCount ( A ; "@" ) = 1 )
                 )