G
gorio
I have a MySQL/PHP based page with a number of date fields that I would
like the user to be able to run a script on to update the fields and
then submit them for server processing.
All my programming to date has been server side, but I feel this
exercise is better done client side, hence my post on this group.
However my javascript knowledge is very limited.
So far I have something like this, I know it won't work like this but
I've googled out many variations without success. I'm just presenting
it in this very basic script to show what I'm trying to achieve.
function datecalc(form) {
form.date1.value = form.date0.value+12;
form.date2.value = form.date1.value+3;
form.date3.value = form.date2.value+5;
form.date4.value = form.date3.value+7;
form.date5.value = form.date4.value+1
}
i.e. I just want to add 12 days to date0 to give date1, 3 days to date1
to give date2 etc etc.
I feel this should be trivial, but have spent many hours trying to find
the solution without success. Seems to me simply a matter of getting
the syntax right but nothing I've tried seems to work, not even an
error message which makes it that much more difficult.
I know my form & php & basic java function work, because if I make e.g.
the first line simply form.date1.value = form.date0.value then when I
hit the submit button the form value of date1 changes to the value of
date0.
The dates in the form are in yyyy-mm-dd format.
Can someone help with my impending alopecia and show me the way?
like the user to be able to run a script on to update the fields and
then submit them for server processing.
All my programming to date has been server side, but I feel this
exercise is better done client side, hence my post on this group.
However my javascript knowledge is very limited.
So far I have something like this, I know it won't work like this but
I've googled out many variations without success. I'm just presenting
it in this very basic script to show what I'm trying to achieve.
function datecalc(form) {
form.date1.value = form.date0.value+12;
form.date2.value = form.date1.value+3;
form.date3.value = form.date2.value+5;
form.date4.value = form.date3.value+7;
form.date5.value = form.date4.value+1
}
i.e. I just want to add 12 days to date0 to give date1, 3 days to date1
to give date2 etc etc.
I feel this should be trivial, but have spent many hours trying to find
the solution without success. Seems to me simply a matter of getting
the syntax right but nothing I've tried seems to work, not even an
error message which makes it that much more difficult.
I know my form & php & basic java function work, because if I make e.g.
the first line simply form.date1.value = form.date0.value then when I
hit the submit button the form value of date1 changes to the value of
date0.
The dates in the form are in yyyy-mm-dd format.
Can someone help with my impending alopecia and show me the way?