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

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 /

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

0 votes

1 answers

2269 views

ANSWER



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).

2 votes