Highlighted

Value of an existing field doen't duplicate in a created field with the same name

New Here ,
Jul 01, 2020

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.

Topics

PDF forms

Views

65

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

Value of an existing field doen't duplicate in a created field with the same name

New Here ,
Jul 01, 2020

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.

Topics

PDF forms

Views

66

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Most Valuable Participant ,
Jul 02, 2020

Copy link to clipboard

Copied

Yes, please share the code, or better yet, the actual file.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
New Here ,
Jul 02, 2020

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) :

Capture d’écran 2020-07-02 à 15.13.43.png

 When my cursor is outside the field :

Capture d’écran 2020-07-02 à 15.13.36.png

 I hope this is clear enough. 

 

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Most Valuable Participant ,
Jul 02, 2020

Copy link to clipboard

Copied

Can't you create a dummy file without the sensitive information, but with the fields?

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Adobe Community Professional ,
Jul 02, 2020

Copy link to clipboard

Copied

Where does you use the parameter "intitule" ?

 

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
try67 LATEST
Most Valuable Participant ,
Jul 02, 2020

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.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Resources
One Stop Solution for Acrobat
Edit a PDF