Skip to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

message in cal field

Featured Replies

when a user enters a date of birth into my date of birth field i have a calculation field called age which displays their age which is set up to be green if 18 or older, orange if 17 or red if under 17.

is it possible to set it up so if the age is 17 aswell as colour change a message is displayed to the user and if under 17 it is not allowed.

You can attach field-level validation to the DOB field using the calc field for direction. So your age calc might look something like this:

Let (

[

now = Get ( CurrentDate ) ;

thisBD = Date ( Month ( DOB ) ; Day ( DOB ) ; Year ( now ) ) ;

passed = now > thisBD ;

age = Year ( now ) - Year ( DOB ) - passed

] ;

Case (

age > 17 ; TextColor ( age & " years old" ; RGB ( 0 ; 255 ; 0 ) ) ;

age = 17 ; TextColor ( age & " years old" ; RGB ( 240 ; 174 ; 0 ) ) ;

TextColor ( age & " too young!" ; RGB ( 255 ; 0 ; 0 ) )

) )

Then on your DOB field, attach this validation: GetAsNumber ( aboveAgeCalc ) > 16

Since you didn't indicate the message you wanted, you can adjust it. But I wanted you to see that whatever message text you put into this age calc can be ignored by the validation by using GetAsNumber() ...

LaRetta :wink2:

I entered your code into FM to give it a whirl and to fully understand it. Works very nice (after I made a small change).

Change "passed = now > thisBD ;"

to "passed = now < thisBD ;"

:P

Yes, silly error on my part. I made the same mistake on another forum today - identical calc. I must be due for vacation. :P

Create an account or sign in to comment

Important Information

By using this site, you agree to our Terms of Use.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.