cancel
Showing results for 
Search instead for 
Did you mean: 

How do I get DateTimePicker to allow empty entry?

csiege
Champ in-the-making
Champ in-the-making
For example, take the effectivity aspect.  Once applied to a document, when editing the document details, there is no way to get an empty date entered!

For more specific examples, we want to capture some metadata dates.  However some dates are not known at the early stage of the document, but there is no way to leave it blank.  It defaults to the current date and there is no empty choice.

Am I missing something? 🙂

thanks!

Chris
3 REPLIES 3

gavinc
Champ in-the-making
Champ in-the-making
No, you are not missing anything, you can not set a date to null as you say.

I have raised this in JIRA: http://www.alfresco.org/jira/browse/AWC-797

csiege
Champ in-the-making
Champ in-the-making
Do you have any guidance on how I can replace the renderer?
Is this a case where I can put my own component generator together to solve this?

thanks.

Chris

gavinc
Champ in-the-making
Champ in-the-making
Yes it is indeed, you will probably need both a renderer for the date picker and the component generator to hook in the new renderer.

You can use the existing renderer as a starting point (org.alfresco.web.ui.common.renderer.DatePickerRenderer) and output the relevant HTML to allow the user to say "None". Your renderer then needs to handle the null value, which it doesn't at the moment!

Register your new renderer in faces-config-custom.xml (see faces-config-common.xml as an example).

You'll then need to do a new component generator, again you can use the current one as a starting point (org.alfresco.web.bean.generator.DatePickerGenerator). You just need to replace the following line


component.setRendererType(RepoConstants.ALFRESCO_FACES_DATE_PICKER_RENDERER);

with the id you use for your renderer.

Then to configure in your component generator you'll need to override the existing defintion in faces-config-beans.xml. Copy and paste the entry into your faces-config-custom.xml and change the class to point to your component generator.

Hopefully this should do it!