Date validation

TColeman

Member
I have a date field that I need to ensure the user has entered today's or a future date. When the Update button is pressed I am checking to see which fields have had changes made to them; however, if the user did not change the date then I need to force them to do so before any changes can be made.

Any suggestions?

Thanks,

Terri
 

Wilbert

New Member
Hi Terri,

Behind the update button, you could simply skip the update code if the date hasn't been changed, message the user to change it and apply entry to this particular date field.

HTH.


------------------
Wilbert
 

jamesmc

Member
Hi there Terri,

Perhaps the date field can be a variable representing the value of the date within the record. You can then compare the value of the date in the record against the variable and if they are the same then you can conclude that the user didn't change it?

HTH

James.
 

TColeman

Member
I had the logic for checking the date, however, how do I get focus to the date field and wait for the user to make an entry? Then once he enters a valid date then move on?

Thanks,

Terri
 

rich_t

New Member
Set up a leave trigger on your date field and do this:

<BLOCKQUOTE><font size="1" face="Arial, Verdana">code:</font><HR><pre>
ON LEAVE OF da-field DO:

ASSIGN da-field. /* assuming its a var and not a db field */

IF NOT /* whatever validation */ THEN DO:

APPLY "ENTRY" TO da-field.
RETURN NO-APPLY.

END. /* is it valid? */

END. /* leave of */
[/code]

That way the user cannot leave the date field unless it is valid as per your logic. You can also have your other fields enabled while this is going on, but ensure at the top of your procedure you start your user off in the date field using the APPLY ENTRY TO statement.

Cheers
Rich
 
Top