PDF-Forms is a service provided by PDFzone.com | http://www.pdfzone.com/
__________________________________________________________________

Morning James

First let me apologize for referring to Acrobat JavaScript as Java  - an
inexcusable Faux Pas on my behalf.
Thanks for the advice  IT WORKS !!! I had thought about this routine briefly
and dismissed it because my
fields were already named e.g.: kit.name.1, kit.name.2, kit.name.3,
kit.city.1, kit.city.2 etc.
Somehow I thought the .name and .city would crash with that routine but
seems I was wrong.

Thanks again
Marc



> Well, in the first place, Java ain't JavaScript; but we get your drift
> :-)
>
> Secondly, renaming all the fields following the recommended Acrobat
> JavaScript naming convention will allow you to make a single statement
> to lock the fields. F'rinstance, say you named the fields kit.name,
> kit.address, kit.city, kit.state, kit.zip, kit.phone, etc. You can then
> issue the statement "this.getField("kit").readonly = true"  to lock all
> fields with a "kit." prefix. You don't have to specifically look for
> all the fields beginning with "kit" because Acrobat JS will do it for
> you.
>
> Sounds like you need a copy of the JavaScript Guide and the scripting
> reference, found at the link below:
> http://partners.adobe.com:80/asn/acrobat/docs.jsp#javascript
>
> Jim Plante
> <[EMAIL PROTECTED]>
>
> On Nov 5, 2003, at 12:30 AM, Marc Stols wrote:
>
> > 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 1will 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 letSCRIPT 2look 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;
> > }
> >
> > ______________________________________________
> >
> > E-mail Disclaimer and Company Information
> >
> > http://www.absa.co.za/ABSA/EMail_Disclaimer
> >
> >
>
>
> To change your subscription:
> http://www.pdfzone.com/discussions/lists-pdfforms.html
>

______________________________________________
E-mail Disclaimer and Company Information

http://www.absa.co.za/ABSA/EMail_Disclaimer


To change your subscription:
http://www.pdfzone.com/discussions/lists-pdfforms.html

Reply via email to