Is it possible to set a date and time field on a Nintex form based on a value in a drop down?
If Completed in selected in the status field, we want the date and time to populate to the current date and time.
any help?
Thanks!
Is it possible to set a date and time field on a Nintex form based on a value in a drop down?
If Completed in selected in the status field, we want the date and time to populate to the current date and time.
any help?
Thanks!
Try this.
NWF$(document).ready(function()
{
NWF$('#'+dropdown).change(function()
{
fnSetDate();
});
});
function fnSetDate()
{
var dropdownvalue = NWF$('#'+dropdown).val();
alert(dropdownvalue);
if(dropdownvalue == 'Completed')
{
var fullDate = new Date();
var twoDigitMonth = ("0" + (fullDate.getMonth() + 1)).slice(-2);
var hours = fullDate.getHours();
var minutes = fullDate.getMinutes();
var currentDate = fullDate.getDate() + "/" + twoDigitMonth + "/" + fullDate.getFullYear();
if (hours < 10) { hours = "0" + hours; }
minutes = minutes - 2.5;
minutes = 5 * Math.round( minutes / 5 );
NWF$('#' + fldDateClosed).val(currentDate);
NWF$('#' + fldDateClosed+ " + IMG + SELECT").val('10 AM');
NWF$('#' + fldDateClosed+ " + IMG + SELECT + SELECT").val('45');
}
}
Do i just put that code into the custom javascript field on the settings of the form? Does this update before or after save?
Yes you need to copy this code in 'Form Settings' under 'Custom JavaScript'. When you change 'Status' drop down value based on selected value this will set current date and time to your date control.
Give names like 'fldDateClosed' to 'Date control' and 'dropdown' to 'Status' like below in your control settings.
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.