cancel
Showing results for 
Search instead for 
Did you mean: 

How to set today's date as Initial value for DateTextBox

satheeshkumar
Champ in-the-making
Champ in-the-making
Hi All,

I have a widget shown below, I would like to set today's date as initial valuee while showing the widget in UI,

var date = new Date();var lastDeployedToPROD = {   name : "alfresco/forms/controls/DateTextBox",   config : {      requirementConfig : {         initialValue : true      },      value : date,      name : "prop_hccm_lastDeployedDateToPROD"   }};‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍


Even after setting the date in "value" field, it is not showing in the UI.
I will have to manually select the date, is there any way to populate the date with today's date.
Please help!!!!

Thanks in Advance,
Satheesh
2 REPLIES 2

muralidharand
Star Contributor
Star Contributor
Hi Satheesh,
Can you please try the below one?
This I have used, in the .get.js file.

var currentDate = new Date().toISOString();//Create the form control for the studentvar formControls = [{      name : "alfresco/forms/controls/DojoValidationTextBox",      config : {         name : "alf_destination",         value : alfDestination,         visibilityConfig : {            initialValue : false         }      }   },   {      name : "alfresco/forms/controls/DojoDateTextBox",      config : {         label : "Student Registration Date",         value : currentDate,         name : "prop_cm_studentRegistrationDate",         requirementConfig : {            initialValue : true         }      }   }];‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍


Please let me know,if it is not helping you.

It works like charm Murali. Thanks for you help.

I just changed my date assignment from
var date = new Date();‍‍‍

to
var date = new Date().toISOString();‍‍‍
Getting started

Tags


Find what you came for

We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.