I have completed a new form that I am sending out to users, and the document variables seem to break after someone signs/saves the document. I have an email button to dynamically send the email based on the raw value of a specific field (EX: Supervisor Email), but it doesn't seem to work after the user saves it. I have confirmed the buttons work just fine when filling the form out for the first time.
supEmail.value = SupervisorEmail.rawValue;
Appreciate everyone's help!
Below are the steps and code for the form.
Step 1: User will complete basic information on who they are, and set .RawValue variables.
Ex: Campus Email. (User EMail.value is the name of the field in the form. In the code below I am just setting the filed value to be equal to the field text input by a users)
userEmail.value = Email.rawValue;
Step 2: User will select the data package they are trying to gain access to. This package will route to the proper data approve through email based on variables set by the "campus" and "data package" fields.
EX: User has selected the Boulder Campus and Finance data package. By selecting these two values, the email button should generate to the appropriate approverEmail. This email value is set to the FINBLD variable that I have set in the form based on the two selection values.
CIWdata.value = CIWdata.rawValue
if(Campus.rawValue == "Boulder" && CIWdata.rawValue == "Finance")
approverEmail.value = FINBLD.value;
else if(Campus.rawValue == "Denver | Anschutz" && CIWdata.rawValue == "Finance")
approverEmail.value = FINDEN.value;
Step 3: User clicks the "send to approver" button which should route to the proper email based on variable selections.
From what you have posted there is no problem that I can see, are you able to share the form? (using a file sharing service)
The error -
We don't know which variable is throwing this error, as the line of code has the following variables
And as has been mentioned before, without more information about what they are or how they are created it is difficult to provide guidance as to where the problem could be.
To start diagnosing this problem I would do the following.
- Remove all unnecessary variables, leaving just enough to be able to create an email.
- Assuming that works, I would then add one variable at a time back in until you find the one that causes the error, this would enable it to be narrowed down to which part(s) of your code need to be investigated.
Hope this helps
The form variables you've added under the form properties can't be modified permanently by scriptings but only for the current session. That's because the form variables are located in the template DOM which is read only. Everytime you open the form in Adobe Acrobat/Reader it creates a virtual form DOM by merging the template DOM and the data DOM. This form DOM represents the current state of the form is rendered to the screen. Whenever you add a signature you're forcing the app the remerge the template and data DOM to a new form DOM, and at this point your're losing the changes to the form variables applied by scriptings before.
To store data in the form you better use the data DOM, which can be changed everytime.
In the XML view of Designer search for "<xfa:datasets".
If it doesn't exist, add it right after the </config> tag.
Otherwise add you own XML structure right below the element <xfa:datasets xmlns:xfa="http://www.xfa.org/schema/xfa-data/1.0/"> as shown below.
<!-- the datasets of the form -->
<!-- here your personal data DOM begins -->
<!-- here your personal data DOM ends -->
<!-- the forms data DOM where all entered data goes. DO NOT TOUCH IF IT EXISTS! -->
To access the values use i.e.: