Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Web Programming > JavaScript > BOOK: JavaScript 24-Hour Trainer
|
BOOK: JavaScript 24-Hour Trainer
This is the forum to discuss the Wrox book JavaScript 24-Hour Trainer Jeremy McPeak; ISBN: 978-0-470-64783-7
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: JavaScript 24-Hour Trainer section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old June 18th, 2014, 10:22 AM
Registered User
 
Join Date: Jun 2014
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default 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
 
Old June 18th, 2014, 04:32 PM
Registered User
 
Join Date: Jun 2014
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default The question has been answered

No one needs to work on it now, thank you.









Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.