Filling date field automatically

Post here questions and problems related to oXygen frameworks/document types.
mu258770
Posts: 119

Filling date field automatically

Wed Jun 20, 2018 11:21 am

Hi

Whether it is possible for Date field to be filled automatically.

Would it be possible to auto-insert the current date when item is inserted?

For example : '<change-completed>' in '<change-historylist>'.

Best Regards
Shabeer
cristi_talau
Posts: 176

Re: Filling date field automatically

Wed Jun 20, 2018 7:20 pm

Hello,

I will describe below a solution that will insert the current date whenever you insert a "change-completed" element using the content completion menu.

You can customize the DITA framework [1] to define an Author Action with the following details:
- Activation XPath: oxy:allows-child-element("change-completed")
- Operation: ro.sync.ecss.extensions.commons.operations.InsertFragmentOperation
- Fragment argument: <change-completed>${date('yyyy-MM-dd')}</change-completed>.

This action should be added to the content completion menu and the element change-completed should be removed from the content completion menu [2].

Best,
Cristian

[1] https://www.oxygenxml.com/doc/versions/ ... works.html
[2] https://www.oxygenxml.com/doc/versions/ ... n-tab.html
cristi_talau
Posts: 176

Re: Filling date field automatically

Wed Jun 27, 2018 10:40 am

Hello,

Here's another (simpler) solution for your use-case. Use CSS to add a button form-control on each empty "change-completed" element. Clicking this button would insert the current date in the existing element. Below is the relevant CSS snippet :

Code: Select all

change-completed:empty:after {
   content: oxy_button(actionID, 'insert-current-date')
}


The action could be defined as "InsertFragmentOperation" using the same fragment as in the post above.

Best,
Cristian

Return to “SDK-API, Frameworks - Document Types”

Who is online

Users browsing this forum: No registered users and 0 guests