I have already a lot of different pdf forms used to register learners as they start their apprenticeship with my company. Different programs mean different length.
Long story short, I have this idea to make the form more convenient where people feed in information like "Learner's name", "Coach", Start Date", choose the programme from the drop down list and click a button and corresponding forms are generated. I am using Adobe Livecycle. However, I got stumped on calculated date field.
1. How do I calculate the EndDate of 18 months minus 1 day from the StartDate. I tried using the script that works on Adobe Acrobat Pro for my current forms but for some reason it doesn't work in Adobe LiveCycle. I have a StartDate field for people to input the info and EndDate field is automatically calculated.
var date= util.scand("dd/mm/yyyy", this.getField("StartDate").value);
2. My second question is if I have different lengths of programs of 13-18 months, how do I improve the script to reflect that?
Many thanks in advance
Why are you using LCD? It makes things much more complicated, and is supported on far less systems.
Unless there's a really good reason I would strongly suggest switching to a "normal" Acrobat form.
I want to create an interactive form .i.e Coach picks Progamme and company size and the corresponding pages appear. Ca this be done with Adobe Acrobat Pro? I used Lifecycle to create a registration form with buttons to add or remove lines and fields hidden which only appear based on what radio button is checked. That's what gave me the idea to make this master form.
Yes, it's possible in an Acrobat form, although in a more limited way, since you can't "re-flow" the entire page. You can show/hide fields, or even pages. If you hide a field there will just be an empty spot where it was located, unless you move other fields to take its place.
LCD uses a different scripting model than Acrobat. While the core syntax is the same the way you access fields and maybe even the util object are different. I can't help you beyond that, I'm afraid.
In XFA forms the "this" keyword refers to the current field object, not the document. And the result of a calculation is simply the last value in the calculation script. If the value is being set from a non-calcualtion, then it is set with the "rawValue" field property.
So, very different scripting rules. You should read about them if you're going to script in an XFA doc.