Home » Developer & Programmer » Forms » how a user do not put date greater than today in date field (FORMS 6i)
how a user do not put date greater than today in date field [message #311606] Sat, 05 April 2008 00:47 Go to next message
gajendra
Messages: 8
Registered: April 2008
Location: INDORE
Junior Member
In my form there is a date field and i want that no user put date greater than today

sample code:

if blk.item > sysdate then
message('you have put wrong date');
end if;
Re: how a user do not put date greater than today in date field [message #311629 is a reply to message #311606] Sat, 05 April 2008 03:48 Go to previous messageGo to next message
Littlefoot
Messages: 21821
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
You've already written code (which seems to be OK). So, what's the question, exactly? Did you try it? Where did you put this code (should be WHEN-VALIDATE-ITEM)? What happened?

Besides, there's no need to code such things at all - modify item's "Highest Allowed Value" property to "$$date$$" (without quotes) and enjoy.
Re: how a user do not put date greater than today in date field [message #311730 is a reply to message #311629] Sun, 06 April 2008 03:36 Go to previous messageGo to next message
gajendra
Messages: 8
Registered: April 2008
Location: INDORE
Junior Member
there is a date field which is a bill recieve date field on this date operator recieve bill from customer so it should not be greater then sysdate.

i am using 2 trigger on date field.

pre-text-item
key-next-item

i am changing the format of date to user by this user can easly put the date in field.

first change in this format ddmmyy(080408) and then before leaving the field it should be change in this format
dd-mon-yyyy (08-APR-2008).

pre-text-item trigger

set_item_property('blk.item' , FORMAT_MASK , 'DDMMYY');


key-next-item trigger

set_item_property('blk.item' , FORMAT_MASK , 'DD-MON-YYYY');
next_item;

and "highest allowed date" take only date not the sysdate.

so can u give me the solution of this problem.

Re: how a user do not put date greater than today in date field [message #311731 is a reply to message #311730] Sun, 06 April 2008 04:27 Go to previous messageGo to next message
Littlefoot
Messages: 21821
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Quote:
"highest allowed date" take only date not the sysdate
Where did I say "sysdate"? If I'm not wrong, I said to use "$$date$$". Did you test it? Of course not! Otherwise, you'd see how it behaves.

As you use KEY-NEXT-ITEM trigger to modify date format, what if user changes input focus using a mouse (instead of a keyboard)? In that case, KEY-NEXT-ITEM trigger wouldn't fire at all.
Re: how a user do not put date greater than today in date field [message #311734 is a reply to message #311731] Sun, 06 April 2008 04:54 Go to previous messageGo to next message
gajendra
Messages: 8
Registered: April 2008
Location: INDORE
Junior Member
thanks very much for this.

i thought put the date in the $$ sign.

i want to show the message to user that "put the date in range" where a can write this message.

again thanks.
Re: how a user do not put date greater than today in date field [message #311772 is a reply to message #311734] Sun, 06 April 2008 13:36 Go to previous messageGo to next message
Littlefoot
Messages: 21821
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Form will display a message; you don't have to do anything.

If you, however, insist on doing it, use the WHEN-VALIDATE-ITEM trigger and MESSAGE built-in or ALERT (whichever you prefer).

In my opinion, Forms default behaviour is just fine.
Re: how a user do not put date greater than today in date field [message #311825 is a reply to message #311772] Mon, 07 April 2008 00:45 Go to previous message
gajendra
Messages: 8
Registered: April 2008
Location: INDORE
Junior Member
thanks for solving my problem.
Previous Topic: update
Next Topic: update error
Goto Forum:
  


Current Time: Sun Nov 10 06:02:10 CST 2024