Skip to main content

I'm working on a form where the start date field should always end date, and set the values equal if the user changes one. The following JavaScript is what I'm trying to use, but getting an error

NWF$(document).ready(function () {
var calStartDate = NWF$('#' + varStartDate);
var calEndDate = NWF$('#' + varEndDate);
//alert(calStartDate.val());
//alert(calEndDate.val());
calStartDate.change(function () {
calEndDate.val = calStartDate.val;
});

calEndDate.change(function () {
calStartDate.val() = calEndDate.val();
});

});

to set a value use .val(value) see http://api.jquery.com/val/ and set date field based on other field selection and  


I was able to resolve that specific error, now I'm getting [object Object] in the date field that is being updated by the change event. Do I need to change the format of the value being replaced?

Version 1:
NWF$(document).ready(function () {
var calStartDate = NWF$('#' + varStartDate);
var calEndDate = NWF$('#' + varEndDate);
//alert(calStartDate.val());
//alert(calEndDate.val());
calStartDate.change(function () {
NWF$('#' + varEndDate).val(calStartDate) ;
});

calEndDate.change(function () {
NWF$('#' + varStartDate).val(calEndDate);
});
});

Version 2:
NWF$(document).ready(function () {
var calStartDate = NWF$('#' + varStartDate);
var calEndDate = NWF$('#' + varEndDate);
//alert(calStartDate.val());
//alert(calEndDate.val());
calStartDate.change(function () {
NWF$('#' + varEndDate).val(NWF$('#' + varStartDate)) ;
});

calEndDate.change(function () {
NWF$('#' + varStartDate).val(NWF$('#' + varEndDate));
});
});

have you seen this - https://community.nintex.com/message/35103?commentID=35103#comment-34952 ?

at first, you should set date control values like

NWF$('#' + varEndDate).val(calStartDate.val()) ;

at second, this will only set date part. for time part you need to add extra calls.

follow the link I posted.


Reply