Print Page | Close Window

Problem protecting form field with "readonly"

Printed From: Foxit's Planet PDF Forum
Category: Lets Talk PDF
Forum Name: JavaScript
Forum Description: Discussions relating to the use of JavaScript within PDF.
Printed Date: 21 Jul 2019 at 4:07am
Software Version: Web Wiz Forums 11.10 -

Topic: Problem protecting form field with "readonly"
Posted By: lamo
Subject: Problem protecting form field with "readonly"
Date Posted: 23 Jul 2018 at 9:32am
Is the "readonly" for form fields supported with Foxit MobilePDF?
I am trying to get it working but no success. The field is still editable on my Android device.

What's wrong?

var v = this.getField("name");
v.readonly = true; 

Posted By: Jackie
Date Posted: 14 Aug 2018 at 12:22pm
Is this any help to you?

this.getField("Interlocking Text System 3").readonly = true;


Posted By: lamo
Date Posted: 22 Aug 2018 at 9:28am
Hi Jackie,
this is the command I am using already. ;-)

I want to proceed as following:

1. User enters fields in the form
2. User clicks SUBMIT button and the PDF should be attached to the email with protected fields.

This is the script I am using, before I submit the PDF.

for (var i = 0; i < this.numFields; i++) {
var fname = this.getNthFieldName(i);
if (fname!="INXMAIL" && fname!="SUBMIT" && fname!="SAVE PDF" && fname!="free") {
     this.getField(fname).readonly = true;

SUBMIT Form - The PDF should be added to the email. Works fine but if I open the PDF the fields are not protected :-( By the way it works with Acrobat on my desktop pc. The protection doesn't work if I fill in the fields on my android smartphone.

What am I doing wrong?

Posted By: Jackie
Date Posted: 28 Aug 2018 at 9:22am
Sounds like its your android smartphone not the code.

don't know anything about smart phones.  You need to check if the program you have on the phone is able to activate the code.


Posted By: gkaiseril
Date Posted: 30 Aug 2018 at 5:54pm
Mobile device PDF reader apps provide little JavaScript support for PDF forms. There many mobile devices that do not even support PDF forms.

For the Adobe Mobile Reader the readonly property appears not to be supported. - Mobile Devices JavaScript API

Print Page | Close Window

Forum Software by Web Wiz Forums® version 11.10 -
Copyright ©2001-2017 Web Wiz Ltd. -