3 Replies Latest reply on Feb 4, 2009 4:09 PM by raybaudi

    Restricting data entry in a field

    jeffd

      Title

      Restricting data entry in a field

      Post

      During data entry into a record I require Field "#1" to equal  a simple "Yes" or "No" input. Then if field "#1" equals a "Yes" then I require the user to input a number > 0 into Field "#2".

      If field "#1" equals a "No" then I want field "#2" to be empty.

      Is there a simple method, by either a script or function or both, that I disallow entry into, blank out, or insert a "0" into Field "#2" If Field "#1" equals a "No"?

      The way I have it now, the user can still put a number, other than "0", into Field "#2" even if Field "#2" is a "No"

        • 1. Re: Restricting data entry in a field
          jeffd
             Is there anyone out there that can help me with this?
          • 2. Re: Restricting data entry in a field
            ninja
              

            Howdy BamaJJ,

             

            I figure you'd rather hear from someone else since my last answer to this same question was off the mark...sorry about that...but since no one else chimed in, perhaps you'll tolerate me trying again...?...

             

            I haven't tried this, but have you considered a filed validation for Field#2 that is a calculation to the general effect of:

            If(Field1="";"0";

            If(Field1="No";"0"

            If(Field1="Yes";Field2>0)))

             

            I don't know if this would work in a validation, but all my other ideas require action after the fact.  Such as the script you mention to "insert a "0" into field #2"

             

            Script:

            Show all records

            Go to Record/Request/Page [First]

            If [Field1 {not equal} "Yes"]

                 SetField[Field2;0]

            EndIf

            Go to Record/Request/Page [Next;Exit after last]

             

            But this would happen after the user already entered it wrong.

             

            Additionally, there are some cool formatting options available on FMP10 that would also help you accomplish what you're after.  What version are you using?

            • 3. Re: Restricting data entry in a field
              raybaudi
                

              Hi BamaJJ

               

              you'll need to enter a calculation into the auto-enter option of Field2:

               

              Case( Field1 = "Yes" ; Field2 )

               

              AND

               

              another calculation into the validation option of Field2:

               

              Field1  ≠ "Yes" or Field2 > 0