Copy link to clipboard
Copied
Hello,
I'm working on a form for a safety review.
In this form, I ask the user to first enter a list of safety events (SE) in a list of fields (named "SE1", "SE2", etc.).
Then, the user clicks on a button that creates a 2-page safety analysis for each SE. This works with a javascript that inserts 2 pages (background only, using insertPages) and then creates the fields to be filled in (using addField).
At the top of each safety analysis page, I remind the title of the event by adding a field the same name of the existing ones ("SE1", "SE2").
The only problem is that the content of this field is only visible if I click on it, otherwise it appears empty.
My guess would be that there is some kind of update function to call... But I can't find anything on that issue.
Would someone be familiar with this issue ?
I can sen you my code if needed.
Thank you for your precious help.
Copy link to clipboard
Copied
Yes, please share the code, or better yet, the actual file.
Copy link to clipboard
Copied
OK, I'm not comfortable with sharing the file for confidentiality reasons, but here is the code.
Here is the content of the Folder-Level javascript :
var insertER = app.trustedFunction(
function(page,file)
{
app.beginPriv();
this.insertPages(page,file);
app.endPriv();
}
);
function construireER(numero,intitule,page){
//--------------------------------INSERTION OF PAGES-------------------------------
insertER(page,"ER_insert_V2.pdf");
//---------------------ADDING FIELDS-----------------------
this.addField("ER"+numero,"text",page+1,[21.23,683.43,573.63,661.43]);
}
The variable numero takes the following values : 1, 2, 3, etc. to identify the safety event (ER stands for safety event in french).
Then in my main document, I have already set up text Fields named "ER1", "ER2", etc. The contain the name of the safety event wich is already filled in by the user. Then the user clicks on a button that triggers the following script :
var ER1Intitule = String(this.getField("ER1").value);
construireER(1,ER1Intitule,4);
The problem I have is that my function construireER doesn't fill up the name of the safety event correctly : it only appears upon clicking on the field instead of showing the name directly and permanently. Here are some screenshots :
When my cursor is in the field (like when typing text) :
When my cursor is outside the field :
I hope this is clear enough.
Copy link to clipboard
Copied
Can't you create a dummy file without the sensitive information, but with the fields?
Copy link to clipboard
Copied
Where does you use the parameter "intitule" ?
Copy link to clipboard
Copied
Yes, I noticed that too. I suspect it's not the full code.
Also, you should not use "this" in your folder-level function, but pass a reference to the Document object as a variable.