cancel
Showing results for 
Search instead for 
Did you mean: 

Default Date to Today's Date

lock999
Champ in-the-making
Champ in-the-making
Hi,

I have a custom content model that has a d:date property. When we assign metadata properties on the property sheet, can we default this date property to show Today's date instead of displaying "None"?

Alfresco wiki has documentation on how to modify this behaviour globally (Resetting_Date_Picker_Behaviour), but i want to change the behaviour only for selected fields/properties and not all properties.

Thanks
1 REPLY 1

gavinc
Champ in-the-making
Champ in-the-making
You can do this for individual properties too. You set up a component  generator for each configuration you need and then use the component-generator attribute on the show-property element. For example:

<managed-bean>
   <managed-bean-name>InitialisedDatePickerGenerator</managed-bean-name>
   <managed-bean-class>org.alfresco.web.bean.generator.DatePickerGenerator</managed-bean-class>
   <managed-bean-scope>request</managed-bean-scope>
   <managed-property>
      <property-name>initialiseIfNull</property-name>
      <value>true</value>
   </managed-property>
</managed-bean>

Then for your property…

<property-sheet>
   <show-property name="my:dateProp" component-generator="InitialisedDatePickerGenerator" />
</property-sheet>

Then all other properties will keep the original behaviour and the my:dateProp property will start initialised.