jeffwest21
IS-IT--Management
Copuld really do with some help with this.
I have been taked with changing someone els's code (never a good thing) and I am stuck
Below is a pice of code that checks if a date is more than 9 months ahead
I have created this, which I thought would check if the date is additonally no more than 14 days past
However it doesn't appear to work, the JS file this is in seems to stop at this point and doesn't run a hide command for now required fields, I do not get any error.
I could really do with this clearing this up and i have been stuck on it for a day or so and need to get the website updated.
'Clever boy...'
I have been taked with changing someone els's code (never a good thing) and I am stuck
Below is a pice of code that checks if a date is more than 9 months ahead
JavaScript:
if(checkDD.value.length > 0){
var d = new Date();
maxDD = d.setMonth(Today.getMonth() + 9);
jsMonth = ddmonth.value -1; //Javascript month values start at 0
jsDate = new Date(DDyear.value,jsMonth,DDday.value);
if(jsDate > maxDD){
alert("Please enter a valid due date.");
return false;
}
}
I have created this, which I thought would check if the date is additonally no more than 14 days past
JavaScript:
if(checkDD.value.length > 0){
var d = new Date();
minDD = d.setMonth(d.getDate() - 14);
jsMonth = ddmonth.value -1; //Javascript month values start at 0
jsDate = new Date(DDyear.value,jsMonth,DDday.value);
if(jsDate < minDD){
alert("Please enter a valid due date, it cannot be more than 14 days ago.");
return false;
}
}
However it doesn't appear to work, the JS file this is in seems to stop at this point and doesn't run a hide command for now required fields, I do not get any error.
I could really do with this clearing this up and i have been stuck on it for a day or so and need to get the website updated.
'Clever boy...'