thank you so much for your timely response. pls note -- we were about
to break out the fake champagne when we stumbled upon something else.
LET ME SAY IN ADVANCE, IF YOU ARE NOT ABLE TO ASSIST {i.e., if it is
beyond the scope of a "free" support answer}, IT WILL JUST BE SURFING
THE NET TO--HOPEFULLY--FIND AN ANSWER. so i still appreciate what you
have done thus far...
anyway, i used your code {modified, as you will note below} ALONG WITH
your date difference sample in your online manual. remarkably,
everything WORKED until i accidentally entered "2008" (08) instead of
09 in the field. lo and behold, it still ended up calculating, albeit
GREATER THAN 300 days :o( . after scratching the head, looking over
your code below, and the code in your online manual again, i came up
with the following add'l code. in the real world, the assumption is
someone can, indeed, inadvertently type the wrong year and so forth.
so this was to validate the date before moving on to the next input
field.
******************************
var v1 = this.getField("DueDate").value;
var v2 = this.getField("RequestDate").value;
var v3 = this.getField("curr date").value;
var d1 = new Date(v1);
var d2 = new Date(v2);
var d3 = new Date(v3);
var days = Math.abs(d1.getTime() - d2.getTime()) / 1000 / 60 / 60 /
24;
this.getField("days").value = days;
if(Math.abs(days) < 15)
{
app.alert("Due Date MUST be > 14 days after Request Date {not
accepting rush jobs at this time}. Thx for your cooperation,
everyone!");
event.target.fillColor = ["RGB", 1, 0, 0];
}
else
{
event.target.fillColor = ["RGB", 1, 1, 1];
}
if(d1 < d2) /// TO CENOPDF TEAM -- also tested using "d1 < d3" as
discussed below ///
{
app.alert("Please enter a valid date.");
event.target.fillColor = ["RGB", 1, 0, 0];
}
else
{
event.target.fillColor = ["RGB", 1, 1, 1];
}
******************************
while the above code WORKED, here is the NEW problem/issue we stumbled
upon ==>
when using/testing if(d1 < d2), i INTENTIONALLY entered 05, 00, etc.
for the year and, YES, the alert popped up to enter valid date. of
course, testing for > 14 days also worked. lastly, testing for say,
next year (10), worked {e.g., request date=12/30/09 and due
date=1/22/10, etc.}. BUT, when i entered, say 95 or 99 or even 75 or
other years [BEFORE 2000] just for the heck of it, IT ENDED UP
CALCULATING WITHOUT SHOWING THE ALERT??? it seems as if the y2k (00)
issues are impacting this---perhaps?? is this a correct assumption or
is something else happening here??
anyway, once we saw that, after MUCH thought the next idea came to
mind to just test the due date against the current {today's} date.
so, using/testing if(d1 < d3) resulted in something even more strange,
if you will:
everything tested similar to the above, EXCEPT when pretending it was
the end of the year. the alert to enter valid date popped up when
testing request date=12/30/09 and due date=1/22/10, etc. arbitrarily
entering other dates beyond this year also caused the alert to pop up
{e.g., 2012 and so forth}.
so, the question for this modified version is, what is happening with
2010 and beyond??? are we going to have all sorts of problems next
year, perhaps, because of whatever we stumbled upon here {sort of like
an alternate y2k issue???}.
now--again--if these queries are beyond the scope of your "free"
support, i understand and it will just take awhile, i s'pose, to surf
the net in search of the answers. but, if you can offer any
suggestions {or hints, as you said below "Please be advised that this
example only gives you the idea about how it works."} ;o) , we would
very much appreciate the assistance.
for now, we are also going to modify the code to look @ a combination
of the request date and due date. maybe using both and comparing the
values will force the request form to do exactly as we want...or, just
maybe, we will open a whole new can of worms. we will see-
in closing, thank you so much for your help. this is still a superior
3rd-party software alternative to the huge expense of adobe and we
look forward to years of use with your product. have a very nice day-
MLA
On Oct 13, 11:29 pm, "CenoPDF Support" <
supp...@lystech.com> wrote:
> MLA,
>
> I have made an example for you. Please see attached files.
> Please be advised that this example only gives you the idea about how it
> works. To compare two dates requires more programming to parse the date
> format, which beyond our free technical support.
>
> The code in attached example is in On Blur trigger of the text box. Here is
> the code:
>
> var input = new Date(event.value);
> var today = new Date();
>
> var diffMS = input.getTime() - today.getTime();
> var diffDays = diffMS / 1000 / 60 / 60 / 24;
>
> if(Math.abs(diffDays) < 14)
> {
> app.alert("it has to be two weeks from today.");
> event.target.fillColor = ["RGB", 1, 0, 0];}
>
> else
> {
> event.target.fillColor = ["RGB", 1, 1, 1];
>
> }
>
> Thanks,
>
> CenoPDF Supporthttp://
www.lystech.com/
> compare-date.doc
> 54KViewDownload
>
> compare-date.pdf
> 85KViewDownload