Templates and prepopulation: variables

Pre-defined variables

JEditor supports the following pre-defined variables in Templates and Prepopulation:

  • {$datetime} - locale date and time
  • {$time-all}  - locale time (full)
  • {$date-cal} - locale date (full)
  • {$time} - locale time (short)
  • {$date} - locale time (short)
  • {$user} - current user's name
  • {$user-fullname} - current user's full name

Custom variables

It's also possible to add custom variables:

1. Go to JEditor Configuration > Custom Javascript
2. Add the following lines to the Javascript field (replace _MYTESTVAR_ with the name of your variable and callback function's code with your code that should return the value of the variable)

JEDITOR.customVariables = {};
JEDITOR.customVariables['_MYTESTVAR_'] = {
  callback: function () {
    return 'PRIORITY: ' + AJS.$('#priority-field').val();

3. Save

This sample code will return the value of the Priority field. It will only work in a dialog where the Priority field is displayed. The code will be executed only once - when JEditor pre-populates a field or when a user inserts a template.

Have more questions? Submit a request


Article is closed for comments.
Powered by Zendesk