The Zurich release has arrived! Interested in new features and functionalities? Click here for more

Is there a way to open date/time picker using a UI macro button ?

shubhampatel
Kilo Contributor

I want to set the date/time value to a read only field which stores string values.

Thanks,

Shubham Patel

7 REPLIES 7

And you can have UI Policy/ onChange client script to keep both date field in sync.


I want a custom date field format for just one field and don't want to change it for all fields.


  1. var field_id = g_form.getControl('start_date').name;  
  2. new GwtDateTimePicker(field_id, 'yyyy-MM-dd HH:mm:ss', true);  

does't seem to work


That script was for catalog item...



Here it won't work because you have string field type and you are trying to make that field to act like   datepicker, right ? for making any field as datepicker, you need to use "Datepicker" plugin.



If you want to make readOnly field then I would say don't display datepicker icon and just create onChange client script on "Installed" date and use below script to set field value:



function onChange(control, oldValue, newValue, isLoading, isTemplate) {


  if (isLoading || newValue === '') {


  return;


  }


  g_form.setValue('u_custom_string_field',g_form.getValue('closed_at'));


  //Type appropriate comment here, and begin script below



}



If that don't work for you, I would say then please explain your use case with some example   ?