These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

Override global field

skacutter
Registered: Dec 18 2007
Posts: 13

Hi: I have a fillable form in which we use global fields to autofill redundent info. I need to allow the user to override the prefilled data from the global field programatically. In other words if the field called "Serial Number" is prefilled by the user by entering this into a global field on page one, On page 10 I need to allow this data to be changed without updating the rest of the fields. How can this be achived?

Thank You in Adavance
Chris

My Product Information:
LiveCycle Designer, Windows
George_Johnson
Expert
Registered: Jul 6 2008
Posts: 1876
Did you create the form fields in Acrobat or LiveCycle Designer?

George
skacutter
Registered: Dec 18 2007
Posts: 13
Forms created in livecycle however they do not need to be. I need to impliment this on a web server that builds forms using PDFlib. For now I just want to know if this is doable via javascript. An alternative would be to NOT USE the global fields but script a methode to auto fill a bunch of fields called by the field name. Because this is not a global binding the updating of individual fields is not a problem...


Thank You
Chris
George_Johnson
Expert
Registered: Jul 6 2008
Posts: 1876
Yes, you should not use what you are calling global fields. The form field names will need to be different. For an acroform (created in Acrobat or PDFlib) you can place some JavaScript code in the first field's Validate event that copies the value to the other fields if they don't currently have a value:

// Get a reference to the other fields
var f2 = getField("SN2");
var f3 = getField("SN3");

if (f2.value === "") {
f2.value = event.value;
}

if (f3.value === "") {
f3.value = event.value;
}

Will you be programmatically filling these fields on the server?

George
skacutter
Registered: Dec 18 2007
Posts: 13
Will you be programmatically filling these fields on the server?

No. the end user will fill in the fields on page 1. The fillable PDF is generated programmatically on the web-server as we pull in documents that are specific to a client. The client needs to tell us something about maintenance on an aircraft

how many cycles are on the engine?
How many cycles are on the airframe?

so we produce a fillable PDF derived from data from our system. In some cases the document may be 100's of pages. We want to offer the ability to fill in this info on the first page and have it auto populate the fields on all pages however somewhere in the document the value for either field may need to be changed.

It looks like your current suggestion will work by appending it to the fields on page 1. With my updated scenario this should still work correct?

George I can't thank you enough for your quick response and suggestions.

Chris
George_Johnson
Expert
Registered: Jul 6 2008
Posts: 1876
Yes, it will still work. I would strongly suggest placing the actual code in a document-level function and call the function from the validate event of the field on the first page.

Also, you mentioned that the PDF may have hundreds of pages. If any of your users will be using Reader and might want to save the (partially) filled-in form, you'll want to research ways to make this possible.

George