All -
I would like to modify all of fields on a form background color in one script tied to a single event. The script would loop through all of the objects on a multipage form and modify the value of the background color based upon whether or not the field has content. I learned that I could change the background color in the "calculate event" and in the initialize event the xfa.host.numPages is always zero. I would much rather right one script to do this then modify a 30 page pdf and every textfield in it. Any help would be appreciated?
Another nasty problem I ran into was that you can't use the Adobe Acrobat Pro JavaScript debugger because the fields aren't populated. Anyway to get around this?
Doug
for (var nPageCount = 0; nPageCount < xfa.host.numPages; nPageCount++) {
var oFields = xfa.layout.pageContent(nPageCount, "field");
var nNodesLength = oFields.length;
for (var nNodeCount = 0; nNodeCount < nNodesLength; nNodeCount++) {
if (ln.length == 0) {
oFields.item(nNodeCount).border.fill.presence = "hidden";
}
}
}
Message was edited by: Douglas Kunzman
Solved! Go to Solution.
Hi, I don't know if you need a code for validation, but I have a script object that would do the job for validating 'x' number of pages in a PDF form.
With this script, you could change some of it or base yourself on how it works to make what you want to do to be able to change something on every fields.
The validation script object returns the somExpression of the first field in the hierarchy which fails validation (returns null, 0 or false).
Take a look at the script, this will lead you on the right way for your form and what you are trying to do.
Validation / Reset Functions, easy to manipulate and to change Forms!!!!
Hope this helps!
Is there anything that the user HAS to do at the beginning or end of the form? like entering the first or last field? Perhaps, you can run a check in the first field which marks all of the fields that are empty (which I suspect should be all of them). Then the last field checks again.
Or since this form is interactive, maybe add a "check my work" type of button that will cause the form to check for blank fields and alert the user.
Side note:
One of the biggest concerns I think you have is that even though you're going to highlight these blank fields, you're still asking the user to dig through 30 pages of fields to look for a page that has a blank entry. So, I recommend that whatever you do helps the user find them.
Perhaps a button could "float" on the side of the form and when the user thinks he/she is done, clicking the button causes the form to navigate to the first blank field it finds by setting the focus to that field. Of course, if some fields are allowed to be blank, then that wouldn't work. I guess the next blank field might do better in that case.
Anyway, either of these options (checking the last field or using a button) should be able to do what you're asking since the form will have completed its layout process by the time they exist.
Views
Replies
Total Likes
Hi -
We are flattening the forms with XML data automatically. Then sending them to the users through email. So I don't think this will work. A button showing what needs to be finished before completing sounds like an interesting idea and when we do editable forms in phase 2 I will bring this up with the client.
Doug
Views
Replies
Total Likes
Hi, I don't know if you need a code for validation, but I have a script object that would do the job for validating 'x' number of pages in a PDF form.
With this script, you could change some of it or base yourself on how it works to make what you want to do to be able to change something on every fields.
The validation script object returns the somExpression of the first field in the hierarchy which fails validation (returns null, 0 or false).
Take a look at the script, this will lead you on the right way for your form and what you are trying to do.
Validation / Reset Functions, easy to manipulate and to change Forms!!!!
Hope this helps!
Views
Likes
Replies
Views
Likes
Replies