Jump to content
Salesforce and other SMB Solutions are coming soon. ×

Valid Dates in Custom Dialog


Recommended Posts

Hi Cafe' laugh.gif


Unless I'm misunderstanding something, one problem with Custom Dialog is that it doesn't validate User Input - not even to verify the correct data type - date. And scripts bypass field validation (except data-type), right? So I'm left validating via script.


Even though it displays date format to the User of how it SHOULD be entered, they can enter anything and it will be accepted. :rolleyes:


I need a validation calc to be sure User enters a format that FM will recognize as a valid date. I want another calc (I think) to convert all 'obvious' (but incorrectly formatted) dates in that global (date) when setting the standard date field.


Do I need two calcs? Well otherwise, that would be one mean hairy-looking Case statement! :eek:


I want to catch the more common date data-entry errors (including 2- and 4-digit year) and, if no year is entered, default to Year(Status(CurrentDate)). Examples:





6-4-2003 etc.


Because validation capability sucks, I always use globals for User input. The validation & conversion can take place after User input has been accepted. If date can't be corrected by the conversion calc, I want the validation to fail so I can present User with options.


The message box displays the input for the User to okay, but if the User entered the wrong date format the first time, they'll okay the same invalid format a second time. :rolleyes:


I don't trust Users to do it right, not with dates. I don't want invalid dates in my date fields! Yes, I said it ... I don't trust Users. I've been one myself for too long. :eek:


Am I being optimistic, paranoid or anal? If I can come up with something great, I'll be able to also use it in scripting all Custom Dialog date fields. laugh.gif


Otherwise, I'll need to use a layout. But 80% of this solution uses Custom Dialog and I would like to also use it for this process so the interface remains consistent. And I don't have the time (beta delivery Monday) to change everything else. frown.gif


Please help me out on this one!



Link to comment
Share on other sites

I knew I had kept a copy of this and just found it! CobaltSky gave a formula which is close to the type of calc I need. I tried to follow the same 'thinking,' but I also need to add dashes, etc. and I keep getting syntax errors or parenthesis mis-matches. :eek:


Date templates - Field Value Storage


I just can't put this together! And it's the last piece in finishing this. Any and all ideas will be greatly appreciated!



Link to comment
Share on other sites

Hello LaRetta,

There is a new demo recently posted to my web site at:




which directly relates to the validation of dates which are input via calculation dialogs. You would likely find it a more suitable solution for the problems you've outlined above than the previous posting that you have referred to.


The demo file incorporates an example validation script - which provides basic validation, handling of 2-digit date entries, plus options for numeric entry or the use of dot or dash separators within dates.


Have a look and see what you think! wink.gif

Link to comment
Share on other sites

Hi Ray! smile.gif


Your calcs look much too short to work. laugh.gif


Oh! But they certainly do! What an ingenious solution. You are maintaining your usual high standards of excellence, I see!


This is exactly what I needed and I can use this with all my Custom Dialog date validations. I'm most appreciative! I can meet my project deadline now, and even take some time to study those calcs. wink.gif




Link to comment
Share on other sites

I have been watching this for two days to see if anyone knew an answer.


Hello Cobalt,


I have been struggling with the concept for verifying dates for three months and this will certainly help us. I notice that it doesn't accept a standard entry of 7/4 and was trying to understand how to make such a change. Can it also accept this type of entry? Regular date fields do but I wasn't sure if your demo can be made to do that also. Thank you for helping us with this problem.


Linda Gent


Link to comment
Share on other sites

This is the best news i've heard in months. If i can figure out how you did that, i can use globals in place of all my date fields so people have some flexibiltiy. But i'm not sure if I'm taking on too much because I'm new to scripting.


i'd still need to force fm to transfer that converted date to the real field upon field exit , right? That's a problem. Pause/resume I think it's called, won't work cus my people can stare at a form for days before finishing it. Well, i'll see what I can come up with. Maybe a plug-in I've read, can force script when leaving field.


This is just toooooooo gooooooood! laugh.gif



Link to comment
Share on other sites

Originally posted by LindaG:

[qb]I notice that it doesn't accept a standard entry of 7/4 and was trying to understand how to make such a change. Can it also accept this type of entry?... /snip[/qb]

Hello Linda,

Yes, with a minor adjustment to one of the calculations, the custom dialog can be made to accept dates with no year specified (which are then always placed in the current year).


I've just posted a revised version of the demo online which incorporates this added option, so if you'd care to visit the site, 'refresh' and download the demo again, you will have an example with that feature added. wink.gif


Originally posted by PiedPier:

[qb]...Pause/resume I think it's called, won't work cus my people can stare at a form for days before finishing it. Well, i'll see what I can come up with. Maybe a plug-in I've read, can force script when leaving field... /snip[/qb]

Hi Pete,

I gather that you want to implement some of the functionality that is offered in the demo I referred to above, but without having to resort to custom dialogs to collect the input (ie having users enter data into fields on a layout).


What you are imagining can be done without a plug-in (though not quite as smoothly) by placing the pause you refer to inside a script 'Loop'. I've prepared a variation on the demo which shows you how this would work. It's available for download now from:




The shortcomings of doing this via script, but without a plug-in are twofold:


1. Each time the loop passes and the script triggers, it briefly takes control of the application, and if this happens to coincide with a user keystroke, the keystroke will be ignored. Thus typing will not be quite as fluid or reliable and occasional keystrokes will fail.


2. Entry into the field can only be achieved by clicking on it (as that is what launches the script) whereas with a plug-in the field can be included in the tab order.


If the above shortcomings are of concern, there is yet another way to achieve date validation and alternate date entry formats which does not require either a script or a plug-in, but works entirely off internal calculations and self-lookups. I've prepared a third demo that shows this technique in action, which is online for download at:




Its results are smooth and seamless, with not a plug-in in sight. But be warned, the calcs and set up are a little exacting and not recommended for the faint-of-heart! wink.gif

Link to comment
Share on other sites

  • Create New...

Important Information

Terms of Use