Populating a Date field using Javascript (and then doing the same on a subform AddRows)
I am having the hardest time populating a Date field using javascript. The only success I have is NOT using a date field and populating a textbox to get a mm/dd/yyyy displayed.
Has anyone tried to populate the Common Date control using Javascript?
Currently this code works when the destination object is a Textbox. When the destination is a Date it generates an error.
function setMyDate()
{
var options = {};
options.fieldId = 'myDate'; // individual control
options.value = '02/02/2020';
eFormHelper.setFieldValue(options, function (result)
{
if (result.isSuccess) //check if is success
{
console.log(result.data); //logs the data holds empty object
}
else
{
console.log(result.error); //logs the error
}
});
}
I have also tried using a local Date object:
// Try 1 - ERROR
// options.value = '02/02/2020';
//
// Try 2 - ERROR
// var tempDate = new Date('02/02/2020');
// options.value = tempDate.valueOf();
//
// Try 3 - ERROR
// var tempDate = new Date('02/02/2020');
// options.value = tempDate.toISOString();
-
Hi Paul,
I verified a similar use case on v8SU2.4 and was able to set the date value for a date control using JavaScript during form load.You could may be provide details on how this function is being invoked or if there is any errors logged in the console on the forum to gather more assistance from the community members.
サインインしてコメントを残してください。
コメント
1件のコメント