Symform Symforms - can you believe: ...
... there is no! other! post! in the entire site of p2p.wrox.com forums that contains the word symform , or symforms ? You read it here first!! Am I earning my pay or what?
Well: symforms enhanced with javascript are what I am working on.
Suppose we have a PDF document, enhanced via symforms to be somewhat interactive. So there are a bunch of symform fields embedded in the PDF document, and let's say that two of them are:
F01 ... the text of a customer's name, and
F25 ... a checkbox
Now, this scenario may seem whimsical, but it does cover what I am trying to do. The goal is to add javascript such that:
(a) if and when F25 is "checked", the text "F25 checked!" will get stomped into F01, _but_
(b) that happens _only_ if F01 is non-blank _and_ the first two characters of the name in F01 are not "Ch".
Here are a few clues from what has worked so far to do other things. Below is a function, named F259sez, that:
-- detects whether field F259 - which is a checkbox - has been checked or not,
-- loads array F with the names of nine other fields, and then
-- uses a biiiiig, already-built-in function (not written by me, but which I could post if anyone wants it) which is accessed as "sympdf.hideShow()" , to make those nine other fields non-interactive _if_ F259 got checked.
function F259sez()
{
var F259ch = this.getField("F259").value == "Off";
var F=new Array();
F[0]="F260";
F[1]="F261";
F[2]="F262";
F[3]="F263";
F[4]="F264";
F[5]="F265";
F[6]="F266";
F[7]="F267";
F[8]="F268";
sympdf.hideShow(F259ch,F);
}
You may be asking, "Ummmm, how might this help me to answer this question?" Well, the above function does show ...
... how we access the value of an embedded field (albeit that field was a checkbox, not a string of text), and
... how we, generally, refer to the names of the embedded fields.
P.S. If you are foxy, you may be looking at this:
var F259ch = this.getField("F259").value == "Off";
... and saying to yourself, "Hey ... if all that is supposed to happen when the checkbox is *checked*, shouldn't that oughta be != instead of == ?" And I would agree. But, the way thet thar sympdf.hideShow() is written , the above code is how it works correctly.
Thank you for your time!
Last edited by howdowelearntocovet; June 18th, 2014 at 01:19 PM..
Reason: typo: an -> a
|