Form text in Acrobat disappears when set to readonly
For some reason, text added to a pre-populated text field disappears when the fields on the page are set to read only. This happens on every page spawned, except the first page.
I have a form setup where users can spawn a new page to enter information for multiple instances. The form has a textarea that prepopulates with several lines of text. I wish for these lines to remain so the users can type next to the text already there.
The text are categories like: Name, Email, Phone (etc...)
I use a dropdown field to populate the text. It is in a Custom Validation Script in the dropdown field (I've found that if I put the text in a Custom Format script in the text field itself, the entire text disappears when you click in that field).
var v = event.value;
var f = this.getField("0Work notes");
f.value = "Name: \nEmail: \nPhone: \nWorking Hours: \n";
When the user types into the field, they just add data after the item category. At the bottom of the page, I have a button that they can click to get a new page for another contact. In addition to creating a new page, the button sets all of the just-filled-in page's fields to read-only. Then a new blank page with the form is added. The 1st page works beautifully.
New pages are spawned from my form. On the new pages, any text added to the field is lost and the the field gets reset to the pre-populated text when the page's fields are set to read-only. The calculation script is identical in the form the pages are spawned from, with the exception of the the text field's identity. I get information about the page number so the correct field name is used.
//Get page number
var currentPage = this.pageNum;
var v = event.value;
var f = this.getField("P" + currentPage + ".Form.Work notes");
f.value = "Name: \nEmail: \nPhone: \nWorking Hours: \n";
At this time, only the pre-populated text gets saved when the page fields are set to read-only and a new page is spawned. Any suggestions would be greatly appreciated.
