Hi,
How to change value via JavaScript in Master Page object (print context)? (2018.1)
For instance:
in Master Page I have
<p id="ident">sth</p>
in JS code I have
document.getElementById('ident').innerHtml = 'sth_else';
does not make change
I donât want to set it in template script (in Script Panel)
Thank you in advance,
Not sure I get what you want to do. Other than using the Javascript language in the server-side scripts (Scripts panel) , you cannot access Master Page from a Javascript file as Javascript file are used with Web Context and the latter donât have Master Pages .
I thought, if I can use client-side scripts for Context\Print\Template I can also use it for Master Page âsectionâ:
example:
I want to print a data&time of printing document (in Master Page âsectionâ)
solution:
in Master Page I have
<div id="timestampMP"></div>
in JS (client-side):
document.getElementById('timestampMP').innerHtml = Date.now();
above doesnât run
But if I have
<div id="timestampFP"></div>
not in Master Page but inside Context\Print\Template
the JS code:
document.getElementById('timestampFP').innerHtml = Date.now();
runs
My question is how to implement JS client-side Master Page âsectionâ, is it possible?
Javascript file are used with Web Context
not quite, documentation says that JS client-side scripts are used with Print Context as well (if I understand well )
Phil
June 10, 2020, 9:48am
4
A client-side script requires a client⌠a printer or a PDF is not considered a âclientâ, but a browser is.
In any event, you should simply add a script to the Scripts pane:
Phil
June 10, 2020, 9:57am
5
By the way, the help file contains some pretty specific information about this:
https://help.objectiflune.com/en/pres-connect-user-guide/2020.1/#designer/Web/Using_JavaScript.htm#toc-5
However, I checked the documentation for 2018.1 and found it did not yet explain that scripts run before the master page is added, so thatâs probably what caused the confusion.