|
Hello everyone
I have two scripts that I've been trying to marry. Not
being a pro at Java I'm achieving as much success as a
fish on a bicycle. These scripts work well on their own in
different documents but I need to have the
functionality of them both in a single document. I have
many different forms with as many different field names.
What I want is to put a field in where "User1" can enter a
password to 'unlock' the form(all fields beginning with "kit") after having
downloaded the form from the intranet. This form has a Master
Password. "User1" then
completes the form and 'locks' the form before e-mailing
it to "User2" . The passwords to 'lock' and
'unlock' the
forms must be different. SCRIPT 1
will work fine but then I'll have to insert a line of
code
(this.getField("kitField").readonly = 1;) for
each and every field in the form. It would be easier for me to insert "kit"
before every field name and somehow let SCRIPT 2 look for all the fields beginning with "kit"
and lock/unlock
only them.
I know you guys are thinking: "Why doesn't he just employ
a User Password ?"
OK !! "User1" can have a User Password to open the form
after downloading, complete the form and 'lock'(simple button script) before
e-mailing to "User2". I DON'T WANT "USER2" TO HAVE THE USER PASSWORD OR
"USER1" TO HAVE THE MASTER PASSWORD .....
Sounds simple, eh ?
Any help would be greatly appreciated!! C'mon Max and
Leonard - this should be a walk in the park.
Thanx in advance
Marc
SCRIPT 1
var pass = this.getField("password");
var passval = pass.value; if (passval == "lock") {
this.getField("lockAlert").hidden = 1; this.getField("kitField").readonly = 1; app.alert("All fields are LOCKED!"); } else if (passval == "unlock") { this.getField("lockAlert").hidden = 0; this.getField("kitField").readonly = 0; app.alert("All fields are UNLOCKED!"); } event.value = ""; SCRIPT 2
// Enumerate through all of the fields in the
document,
// and set them to lock/unlock unless they have 'kit' as 1st part // of field name for (var i = 0; i < this.numFields; i++) { var f = this.getNthFieldName(i); console.println(f.substring(0,3)); if (f.substring(0,3) != "kit") this.getField(f).readonly = false; }
______________________________________________ |
- Re: [PDF-Forms] Locking and unlocking fields Marc Stols
- Re: [PDF-Forms] Locking and unlocking fields James Plante
- [PDF-Forms] Locking and unlocking fields Marc Stols
