2 Replies Latest reply on Nov 23, 2014 8:05 AM by philmodjunk

    Validations

    TKnTexas

      Title

      Validations

      Post

      I have a phone number field.  It is set to text.  I overlay a calculation field that formats the phone number. It works.  I could enter the phone number.  I can edit the phone number.  So with it working like I wanted, I added validation to the ENTRY field, restrict to numbers only, validate length = 10, and present a message. 

      When I deleted the phone number, it displays the error message.  If I leave it blank to start with there is no issue.  But when I add a number I can not delete it.  

      It is not a mandatory field.   When I turn all of the validations off it is ok.  I have tried using ONE validation.  For any of them singularly or multiple it will not let me delete the item.  Bug?

        • 1. Re: Validations
          schamblee

          I use a auto-enter calculation that filters out everything but numbers, also uncheck 'Do not replace existing value'.

          Let (
                  [ num = Filter ( PhoneNumber ;"0123456789" );
                    num = Case(Left(num;1)= "1"; Middle(num;2;20); num);  // remove 'Dial 1' if it's there
                      len = Length(num) ];

          Case( len = 10; TextColor(Left( num; 3) & " " & Middle( num; 4; 3) & "-" & Middle( num ;7;4); RGB(0;0;0)); // with area code
                    len = 7;  TextColor( Left( num; 3) & "-" & Middle( num;4;4); RGB(0;0;0)); // without area code
                    TextColor(num; RGB(255;0;0) ) ) // wrong length so make text red
          )

          • 2. Re: Validations
            philmodjunk

            I also favor Raybaudi's solution, but just to answer the original question, You can modify your original validation calculation by adding a term with the OR operator to allow an empty field.

            IsEmpty ( Self ) or //put your current validation calc here