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.

Testing date entered in custom dialog

Featured Replies

Hi and thanks in advance.

I have a script which requests the user to type a date. The date is typed into a global date field.

My problem is that, unlike typing a date direct onto a layout, typing it into a custom dialog doesn't check that the user has typed an actual date in e.g 3/112/2007 etc.

My question - how can I test in the script whatever they've typed to see if it's a valid date or not.

Thanks in advance.

Hi

go to validation option of your global date field and check: Always

  • Author

ahh so easy doh, thanks.

Validation will not protect against invalid dates if placed in the global date field via Custom Dialog. Use an IsValid (gDate) test instead as:

If [ not IsValid ( gDate ) ]

... test fails

Else

... test passes

End If

The reason it will fail is that it can fire when the script has already proceeded to another step - or another layout. Then the validation will fire and it will be too late. It has to do with the validation not firing until a Commit Records/Requests happens ... the timing can whack, ie, even if you start with Commit and even if the validation fails, your script will keep going. Testing for IsValid() allows you to simply Halt Script before it begins.

LaRetta :wink2:

Edited by Guest

Validation will not protect against invalid dates if placed in the global date field via Custom Dialog.

Are you sure ?

Have you tried to set: Always ?

The reason it will fail is that it can fire when the script has already proceeded to another step - or another layout.

How can the script proceed if it waits for the user enter a valid date ?

Hi Daniele,

Custom Dialog with dates always failed prior to 7. I was sharing my personal experience and aversion to trusting field-level validation to fire when expected (since behavior has changed in vs. 7 on record commit). But I think I might be too tight here; that using 'Always' will bypass the problem because it will not proceed in that instance.

I can suggest a read here. There have been many posts in which field-level validation misfires unexpectedly. I just don't trust it; even without validation, an invalid date will fail if User types into it. But when used within script, it can be iffy. It feels the same as trusting that Developer-created serials (based upon self-join) will never fail ... it's kinda hard to prove but can nonetheless happen.

Regardless, I believe I was too tight; and if Allow User Override is unchecked and you use Always, you should be okay.

LaRetta :wink2:

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.