I need some help on this one. I have a date field that contains a custom calculation function. This function is used to increment the days of the week.
Here is the function:
function countDays(z){
var a = (1000*60*60*24) * z;
var b = 0;
var c = new Date();
var d = this.getField("date1").value;
if(d!=""){
var e = Date.parse(util.scand("mm/dd/yyyy", d));
c.setTime(e + a);
event.value = util.printd("mm/dd/yyyy",c);}
}
The function works fine for its purpose, however, there is an instance where the user can overrride this date and input their own date. This also works fine. The issue is that I want to display/retrieve the date that was input. When I attempt to display the inputted date from the field (in another field), it just displays the current date rather than the date that was input. I need it to display the date that the user inputs.
I suspect I need some keystroke event to commit the inputted value but I am not quite sure how to do this. I have tried various scripts, but I am begining to wonder if the original code placed on the calculation script is overriding any code I have tried in the keystroke event.
How or under what conditions are you calling the function?
It looks like your function adds the 'z' number of days to the date entered in the 'date1' field.
I would also comment the function and write it to be independent of date format, any date field, and adjusting any field field. The comments might help others understand what you are trying to do with your code.
George Kaiser