4 Replies Latest reply on Jun 8, 2017 9:57 PM by JimmyCox

    Simple message box

    thekops

      Hi, I am trying to have a message box to pop out if the user enters a negative figure for the user age. I got the script for the age working but cant seem to get the message box right. Help please:) (PS: new to FM)

        • 1. Re: Simple message box
          jbrown

          Hi.

          The simplest way is to use the field's validation and allow only numeric values within the range of 0 to 100.

          There are other ways, but this is the simplest. Those other ways include using a script trigger and checking the value onValidate

           

          Screen Shot 2017-06-08 at 8.52.28 PM.png

          • 2. Re: Simple message box
            philmodjunk

            Often the buttons in the validation error dialog confuse users or don't permit the option that you want to use to correct the error.

             

            Thus, you can also use OnObjectValidate to perform your own script to both error check and to provide user friendly ways to correct that error. With such a script, you can use either a custom dialog or a popover to display your message.

            • 3. Re: Simple message box
              thekops

              I am currently using a calculation field so I dont think I am able to use this method. But thanks!!

              • 4. Re: Simple message box
                JimmyCox

                If you are using the calculation I gave you in another thread, the user shouldn't be able to enter the age, only the date of birth.

                 

                In the field options for your Date of birth field, go to the validation tab and then Validate by calculation and put this in there:

                Self  ≤ Get ( CurrentDate )

                 

                You can then display a custom message if the validation fails.