Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

This topic is 6461 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

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.

Posted (edited)

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
Posted

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 ?

Posted

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:

This topic is 6461 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

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