Create new value based on adaption of datepicker value

m.pradel 12 Sep, 2013
Hi Bob,

based on the your javascript in this thread http://www.chronoengine.com/forums.html?cont=posts&f=26&t=25499. I've adapted the javascript to used the datepicker date as based for calculate a new date and fill it into a text box field.

Here the adapted script code:


function berechnegarantieende() {
    var garantiebeginn = document.getElementById('garantiebeginn_clone_id').value;
    var garantieende = garantiebeginn;
    garantieende.setDate(garantiebeginn.getDate() + parseInt(garantieende));
    var garantieendetag = garantieende.getDate();
    var garantieendemonat = garantieende.getMonth();
    var garantieendejahr = garantieende.getFullYear()+20;
    $('garantieende').set('value', garantieendetag+"."+garantieendemonat+"."+garantieendejahr);
  } 


And I use the datepicker config to trigger the event


onClose: berechnegarantieende


Now I get the console message that the script 'Cannot read property 'value' of null' for the datepicker_clone_id_field. (J3.1.5, Chronoform V4 Stable)

Do you have a hint for me, what went probably wrong?

Regards,
Marc
This topic is locked and no more replies can be posted.