cancel
Showing results for 
Search instead for 
Did you mean: 

Make a custom template layout get/set from a date field

mark_
Champ on-the-rise
Champ on-the-rise

Hi,

I'm trying to get a custom template layout to set to a date field in the database.

In the custom template the field is linked to a dropdown with a set of pre-specified date values, which matches up against the date format in the db.

   <widget name="data editor" type="template">
			<labels>
				<label mode="any">Data Editor</label>
			</labels>
			<translated>false</translated>
			<fields>
                                     ...
				<field>ad:initialPrintPublicationDate/text</field>
			</fields>
			<properties mode="any">
				<property name="template">/widgets/vehicle_data_editor_widget_private.xhtml</property>
			</properties>
      </widget>

Is it possible to designate this field as a date field, while all the other fields that are being passed in a text fields?

I've found that you can you append / is it possible to structure this so that it will convert the value to and from a string?

ad:initialPrintPublicationDate/text

We are using nuxeo 5.3 btw...not sure if this complicates matters.

1 ACCEPTED ANSWER

Anahide_Tchertc
Elite Collaborator
Elite Collaborator

Hi, The field mapping "ad:initialPrintPublicationDate/text" is not correct: this will not set the value property on your field. The best option here relies in what's the widget template "vehicle_data_editor_widget_private.xhtml" is doing. In your case you should use a JSF converter to handle the conversion between the text field selected by the user, and the date you'd like to set on the property (either creating a Date or Calendar instance should work).

View answer in original post

1 REPLY 1

Anahide_Tchertc
Elite Collaborator
Elite Collaborator

Hi, The field mapping "ad:initialPrintPublicationDate/text" is not correct: this will not set the value property on your field. The best option here relies in what's the widget template "vehicle_data_editor_widget_private.xhtml" is doing. In your case you should use a JSF converter to handle the conversion between the text field selected by the user, and the date you'd like to set on the property (either creating a Date or Calendar instance should work).

Getting started

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.