This topic is locked

Calculate Date with JavaScript on load - Event

1/27/2018 7:03:16 AM
PHPRunner General questions
T
taumic author

I want to calculate an input field (date[fa_bindefrist]) depending on a second input field (months[fa_bindung]).

I choose the months from a dropbox (e. g. 6) and want to have the date calculated by Javascript on load event: Date is today + number of months.

Sounds easy, but I just can't get it right.

This is my code:



var ctrlBindung = Runner.getControl(pageid, 'fa_bindung');

var ctrlBindefrist = Runner.getControl(pageid, 'fa_bindefrist');
function func() {

var heute=new Date();

var Monat=heute.getMonth();

Monat = Monat + ctrlBindung;

heute.setMonth(Monat);

ctrlBindefrist.setValue(date(heute.toLocaleString() ));

};
ctrlBindung.on('keyup', func);


Can anyone help?

Thank you!
Michael

T
taumic author 1/29/2018



http://www.asprunner.com/forums/topic/21971-calculate-number-of-day-automatically-when-two-dates-are-selected/
... for inspiration purposes only ...


Thanks for the inspiration, then I try again.
Michael