Page 1 of 1

Autofill with Current Date

Posted: Wed Dec 01, 2021 12:02 am
by SixForty
(I'm putting this here because I don't believe it's possible to do this. If it is, I'd be happy if someone can explain to me how.)

I'm wondering if it would be possible to add some type of "current date" option for the Content Completion Assistant in Text Mode when an attribute's data type is defined in a Schema as xs:date (or similar)

I work a lot in the Text Mode of OxygenXML Editor, dealing directly with the XML files in a growing project. I'm trying to integrate some tracking data, and being able to autofill an attribute with the current date, instead of always having to type in the date, would be a very nice benefit.

Thanks for the consideration!

Re: Autofill with Current Date

Posted: Thu Dec 02, 2021 8:33 am
by Radu
Hi,

In Oxygen we have support to define and use code templates:
https://www.oxygenxml.com/doc/versions/ ... ting2.html

A code template defines a small piece of XML and it can later be used when pressing "Ctrl-Space" in the editor.
Inside code templates you can use Oxygen editor variables which get automatically expanded when the code template is inserted:
https://www.oxygenxml.com/doc/versions/ ... ables.html
For example you can use our "date" editor variable with a certain pattern:

Code: Select all

<created date="${date(yyyy-MM-dd)}"/>
Regards,
Radu

Re: Autofill with Current Date

Posted: Thu Dec 02, 2021 11:22 am
by SixForty
Two things:

First, I guess I should have spent more time digging. I might have been able to piece this together. Sorry to take up your time.

Second, Radu, you are awesomeness personified, and my new best friend. You gave me a solution that is exactly what I was looking for, except one step better. Thanks so much!