I am new at this but have been able to create a new form (invoice) in live
cycle 8. There is also a statement page after the invoice
that gets populated and it works great. The problem is I can not figure
re out how to let the user crate another invoice ( same form new info
) and let some of the info from the first populate to the secon
d and so an so on. I do not know the correct term for this.
Views
Replies
Total Likes
Hi,
You can achieve this, but it will need some scripting and some additional settings.
Basically you would need to add a button to the invoice page that would allow the user to create a copy of the invoice page. There is an example here: https://acrobat.com/#d=nyxBeJlwdS4ZY2euTZxMKA.
You will need to select the page in the hierarchy and then in the Object > Binding palette tick that the object can be repeated.
If you have a look at the script in the add and delete buttons you can see how the new instances of the page are handled.
Lastly, you must save the form as a Dynamic XML Form in the save-as dialog.
Hope that helps,
Niall
Views
Replies
Total Likes
Views
Replies
Total Likes
Hi,
In the example, I have named the page as "page1" in the hierarchy. If you have named the page differently, then you would need to change the script to suit your naming convention.
By the looks of the error, you have not named the page at all. It might look like this in the hierarchy "(untitled Subform) (page 1)". It is a bad idea to have unnamed pages and subforms. It makes it very difficult to script against these unnamed objects, as you will need to resolve the nodes.
If you have created the form by importing an existing Word document (or possibly PDF), then some dynamic features may not be available. If this is hte case, you may need to create the form from scratch.
Hope that helps,
Niall
Views
Replies
Total Likes
Ok again, thanks for the info. I have it working. Page 2 of my form is a
schedule where as data from the fields that are filed in by the user on the
invoice, page 1, should populate but now they will not. I keep getting an
error saying unknown field.
I really hate to ask but could you think of what I may be doing wrong or do
you know some one that would complete my form/ This is frustrating me to no
end.
Thanks
Views
Replies
Total Likes
Yes
Views
Replies
Total Likes
Hi,
I suspect that the references to the object are not correct or you have unnamed subforms/pages.
When referencing objects you are use a relative reference, which specifies the object with the minimum amount of information. - "clear as mud".
For example if two objects are on the same page (and in the same subform), then this would work:
this.rawValue = textfield1.rawValue;
However if textfield1 was on a different page and in a subform, the relative reference needs mor information:
this.rawValue = page1.subform1.textfield1.rawValue;
This example is not finished yet, so that it with a pinch of salt. If you open it in Acrobat/Reader and then hover over the script. The intention is that it will highlight each part of the reference. As yet there is no supporting text in it - it is a work in progress.
There is a trick that you can use in LC Designer to automatically insert references.
Hope that helps,
Niall
Views
Replies
Total Likes
Great tip.....Worked very nice. However--sorry;
When I click the add page button you taught me, the 2nd invoice works just
like it should. My fields populate correctly but;
The second row of fields on my schedule do not populate. I am thinking
thats because I am not sure what field to reference when the second invoice
completes. Dose the form automatically re-name the same field? Example:
On the first invoice there is a field called Customer. When the second
invoice is created, does it change that field to Customer1 or something?
Views
Replies
Total Likes
Hi,
All objects have an instance number, which is zero-based. When scripting general objects you do not need to worry about the instance, as there is only one object, "Customer".
However with repeating objects, the instance number becomes more relevant. The instance number is in square brackets after the repeating object's name.
If we say that the invoice is on "page1", which is the repeating object and "Customer" is an objects on page1. You can reference each instance of the invoices by using "page1[0]", "page1[1]", "page1[2]", etc.
In your case the "Customer" object is not repeating. It is the "page1" object that is repeating. Therefore to access specific "Customer" objects on diferent pages, you would need:
"page1[0].Customer"
"page1[1].Customer"
"page1[2].Customer"
"page1[3].Customer"
etc.
Note that when scripting in JavaScript you would need to resolve this node:
this.rawValue = xfa.resolveNode("page1[0].Customer").rawValue;
If you want the schedule to gather information from each instance of the invoice page, then you could either set up a loop or have an if statement checking if each instance exists. The route would depend on if you are going to limit the number of invoices that can be added (say max. = 10) or if the user can add an unlimited number of instances (in which case the schedule is also unlimited).
In either case you are getting into a bit of more involved scripting. Are you happy with this?
Niall
Views
Replies
Total Likes
Once again you have come through with flying colors. Everything worked
great. The schedule gets populated as you stated. I have the limit of
invoices set to 20.
I am getting several scripting errors and I assume they are because all
those fields do not exist until the invoice is generated. Can you give me an
example of the "if" statement. I am using the following calculation using
formcalc/client side to reference the fields I need:
form1.Page1[1].Header.Company
form1.Page1[2].Header.Company and so on....
How would I add the if to these..
Thanks
Views
Replies
Total Likes
Hi,
If you have script in row 6 of the schedule. which is looking for invoice 6, then the following should work in the calculate event.
if (_Page1.count >= 6)
{
this.rawValue = xfa.resolveNode("Page1[5].Header.Company").rawValue;
}
Note that .count is not zero-based, so "6" will be the sixth invoice. The instance number is zero-based, so this is why we use "5".
Lastly, the underscore before the repeating object is shorthand for instanceManager.
Hope that helps,
Niall
Views
Replies
Total Likes
Hi Guess Who
if (form1.Page1.count >= 2){this.rawValue
=xfa.resolveNode("Page1[1].Header.Company").rawValue;}
This a formcalc script I placed on the second line of my schedule. It is
suppose to return me the company name on the second invoice. There is
nothing returned yet I do not get an error pertaining to this script.
Views
Replies
Total Likes
Hi,
There are a couple of issues:
if (_Page1.count >= 2)
...
Hopefully it will work then.
Niall
Views
Replies
Total Likes
Got back to my form and with all your help it all works great. I have one
last issue I am trying to resolve;
I have the button that creates a new invoice.
This is the script: It is a click event using java
form1.Page1.instanceManager.addInstance(true);
I want to add to this script so when the button is clicked, the user is
taken to that page.
Can you help?
Views
Replies
Total Likes
Hi,
You can use the setFocus method, but would first need to determine the number of pages.
form1.Page1.instanceManager.addInstance(true);
var i = form1.Page1.instanceManager.count;
var vTarget = xfa.resolveNode("form1.Page1[" + i + "].Header.Company");
xfa.host.setFocus(vTarget);
This should work. If not have a look at the Help for setFocus.
Niall
Views
Replies
Total Likes
I had a tuff time trying to figure out your selection so I added this script
to my original script to call for the InstanceManager and it works
perfectly.
// Go to the next page. xfa.host.pageDown( );
I want to thank you for taking the time to help me in completing this task.
I have been out of work here in Texas for 8 months and just trying to help
out a friend who has thrown me a bone. I have never expected someone to do
my work for me, just give me a little of what they have acquired over the
years and maybe I can give them a little of what I have acquired. We are
indeed strangers that have never met yet we have been just as courteous to
each other as if we had known each other for a long time. It's so refreshing
to be able to do that. Thanks for your patience and your obvious expertise.
If I can ever help, just let me know.
Steve
Views
Replies
Total Likes
You are very welcome Steve!
I am glad you have it working.
I would strongly recommend JP Terry's book on LC Designer which is excellent - "Creating Dynamic Forms with Adobe LiveCycle Designer". This starts at the beginning and clearly sets out key learning points. By the end there are some good examples, which you can copy across into your forms.
We have some solutions and blog posts on our website http://www.assuredynamics.com.
There is also a range of online resources. You may find these resources helpful:
http://www.adobe.com/go/learn_lc_scriptingBasics
http://www.adobe.com/go/learn_lc_scriptingReference
http://www.adobe.com/go/learn_lc_formCalc
http://www.adobe.com/devnet/livecycle/articles/Adobe_XML_Form_Object_M odel_Refer ence.pdf
http://www.adobe.com/devnet/acrobat/pdfs/lc_migrating_acrobat_xmlform. pdf
And a very handy resource (and while it is for version 6 it is still very good because of the way it is laid out):http://partners.adobe.com/public/developer/en/tips/CalcScripts.pdf
The Help file in LC Designer can also help you with syntax and LC Designer itself comes with some great templates and examples.
Lastly, check out the Developer's Network on http://www.adobe.com/devnet/livecycle/
Also a book that doesn't deal with scripting at all but is very good on form layout is "Forms that Work" by Caroline Jarrett and Gerry Gaffney.
The Adobe "PDF Forms Bible" is okay, but mainly focuses on AcroForms.
Windjack Solutions have a subscription based service for solutions and scripts at http://www.pdfscripting.com. It has a lot of AcroForm script that can be amended to suit LC Designer and a growing library of LC Designer solutions.
I hope that things pick up!
Good luck,
Niall
Views
Replies
Total Likes
Hi Niall, remember me?
I had to make a change on the form you helped me create but I think, with
your help, I can get through this. Here it is
I have my form setup where the user can click a button and a new invoice is
started. The data from the invoices they create are populated to my schedule
form which is page 2 of the form. The schedule can accommodate data from 20
invoices. The user can create up to 80 invoices. I need to make the schedule
flow over to a new schedule page when all 20 lines of data are populated. I
am pretty sure it will do this automatically but I am not sure how to make
it flow. The new schedule page would just be a duplicate of the first in all
ways except the lines of data.
Can you help?
I would be glad to send you the form if I have been confusing.
Views
Replies
Total Likes
I HAVE A JAVA CODE IN A CLICK EVENT THAT EMAILS MY FORM. EVRYTHING WORKS GREAT EXCEPT I WANT THE SUBJECCT LINE TO READ LIKE THIS;
Client Id is (THE CONTENTS FROM A FIELD NAMED ClientId)
I AM NOT SURE HOW TO PLACE THIS IN MY CODE. THIS IS THE CODE I AM USING
var oDoc = event.target;
oDoc.mailDoc({
bUI: true,
cTo: "EMAILADDRESS@ANYWHERE.com",
cMsg: "Invoices & Schedule",
cSubject:("form1.Page1.Header.ClientId"),
})
app.execMenuItem("Close");
iT DOES NOT WORK
Views
Replies
Total Likes
Hi,
Have a look at the script here: Re: Don't send any XML/PDF/data with an email PLUS send encrpyted data
I tend to build the subject (and other elements) outside of the mail script, as variables.
In the script example you construction of the vSubject variable would look something like this:
var vSubject = "Client ID is " + form1.Page1.Header.ClientId.rawValue;
Hope that helps,
Niall
Views
Replies
Total Likes
Thanks, I am not aware of this. If I build this script outside the mail
script, where does it go and how do I trigger it
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies