Skip to content
Snippets Groups Projects
onValueChange.js 697 B
Newer Older
import("DocumentTemplate_lib");
import("system.neon");
import("system.vars");

// note: could not use only the valueProcess from $field.Content because then it refreshed $field.Content just before save.
// --> only set in $field.Content.valueProcess if $field.Content is null and set it from here only if MASK triggered change
if((vars.get("$sys.operatingstate") == neon.OPERATINGSTATE_EDIT || vars.get("$sys.operatingstate") == neon.OPERATINGSTATE_NEW))
{
Johannes Hörmann's avatar
Johannes Hörmann committed
    [content, type] = DocumentTemplateUtils.getTemplateContent(vars.get("$field.DOCUMENTTEMPLATEID"), new FileUpload(vars.get("$local.value")));
Johannes Hörmann's avatar
Johannes Hörmann committed
    vars.set("$context.currentTemplateType", type);
    vars.set("$field.Content", content)