Subject Re: KMDATEWITHCAL (dUFLP)
From Ken Mayer <dbase@nospam.goldenstag.net>
Date Mon, 19 Mar 2018 07:25:54 -0700
Newsgroups dbase.getting-started

On 3/19/2018 7:22 AM, Ken Mayer wrote:
> On 3/19/2018 1:25 AM, Mustansir Ghor wrote:
>> Dear Ken Sir
>>
>> I am using kmdatewithcal.cc . An observation is made that once the
>> date is updated in the DATEEF by onclick button of calendar it does
>> not respond to a any methods like VALID, LOSTFOCUS etc.
>>
>> Can you advised what can be done to avail these methods
>
> In the form designer, with valid (this is particularly important), you
> need to set validRequired to true, or it won't require that the valid
> event handler do anything.
>
> I did some tinkering (also the next version, when you click a day, the
> calendar will collapse/close, not sure why I didn't do that in the first
> place).
>
> Anyway, I tested this with valid, clicked on the entryfield itself in
> the designer, selected the valid event in the inspector, and added this
> code:
>
>     function DATEEF_valid()
>        bReturn = false
>        if this.value == {} or this.value <= date() // less than or equal
> to today
>           bReturn = true
>        endif
>     return bReturn
>
>
> I set "validRequired" to true, and set a simple message with
> validMessage to "Date out of range". If the date field is empty, or if
> it has a date less than or equal to today's date, all is well, focus is
> allowed to leave the entryfield, otherwise it forces you back to the
> entryfield ...
>
> Works perfectly.

Except that the one problem is -- you can't, with an invalid date, leave
the entryfield, and therefore the pushbutton to open the calendar is
ineffective ... (This is one reason I don't like using valid ...)

Ken


--
*Ken Mayer*
Ken's dBASE Page: http://www.goldenstag.net/dbase
The dUFLP: http://www.goldenstag.net/dbase/index.htm#duflp
dBASE Books: http://www.goldenstag.net/dbase/Books/dBASEBooks.htm
dBASE Tutorial: http://www.goldenstag.net/dbase/Tutorial/00_Preface.htm