First off, sorry if this is the wrong section. Adobe Forms isnt exactly Web Development, but its the only place I could find to post about javascript. If this isnt the correct section, could someone please redirect me? Thanks.

Now, onto the question (please note, I am inexperienced with javascript).

I have an Adobe form with a default text like this
[IMG]http://content.screencast.com/users/Yoni09/folders/Jing/media/e3209110-ea34-40d7-894f-ef44a6b57487/field1.png[/IMG]

I have javascript that looks like this, so that when tabbing into the field, it skips past the default text:

function SetEnd (text)
{
if (text.createTextRange)
{
var FieldRange = text.createTextRange();
FieldRange.moveStart('character', text.value.length);
FieldRange.collapse();
FieldRange.select();
}
}

SetEnd(this);

I was wondering if there is a way to make it so the default text cant be changed at all. Even better would be an alternative way of having the default text there but not "part" of the field, but at the same time, not being able to type over it either. Thanks!

Recommended Answers

All 11 Replies

I am assuming this is a PDF file, if so - how was the original one created? Just curious since there may be an easier way depending on how it is created.

Sorry it took so long to answer, my computer was down for a bit. The PDF was created out of a word document and then edited.

It sounds like you have the full/professional version of Acrobat, if you can edit the PDF file after it is made.

Open Acrobat, and under the Advanced Menu choose Security. (Advanced>Security). Then Choose Show Security Properties. (Advanced>Security>Show Security Properties)

This will open a Dialog window where you will see "Security Method" and it will default to "no security" - you can choose from Password Security, Certificate Security and Adobe LifeCycle Policy Server. The easiest (imo) is the password security.

Once chosen, it will open a dialog box for "password security - settings"

At the bottom of that window will be the option to restrict editing and printing with a password being required to do either (or each).

Finish this, and you have a password protected PDF.

There are definitely more advanced settings - but this is the easiest way I can think of.

Im not looking for pass-wording the PDF. I want to make it so that the default text in a form input field cant be edited.

Just go to the pdf file and the edit view for the form - choose to view the properties. This will give you the option to create a "Read Only" form item.

Attached is a jpg showing the dialog window.

Yes, but I want the form to be editable. I just dont want the default text to be editable.

Ok, I am not sure what it is you are asking to be honest. You are meaning that you dont want the text for the form itself to be editable - it is that way by default when you save the file and the other person opens it in Adobe Reader. If you dont want them to be able to edit the text in a program like Adobe Professional - then you have to go to the security settings. You can set a parameter that they can not edit the text, but the form itself will still be usable.

When you say "default text" that to me is the text in the form field that you are having them change. The text for the form, is just text and will be stationary and uneditable when they open it. Unless - like I stated earlier - they have Adobe Professional and you have not set the securities.

When you save the form, you do need to make sure you set the permissions to allow people using Adobe Reader to use and save the form once edited. Which is under Advanced > Enable User Rights in Adobe Reader. They will NOT be able to edit the text. Remember, you can edit the text because 1. you are creating the form, 2. you have acrobat professional and 3. you have not stated to Acrobat using security settings that you don't want people to be able to edit the form.

Security settings is not just passwording, it is setting permissions where if they try and either edit the text or get an image they have to have a password. It isn't just a blanket password for the PDF file.

Attached is a PDF file where they can use the form, but NOT edit the text. This was done using the security settings in Acrobat. It is not necessary to use Javascript for this function.

Ok let me try and make my question a bit clearer. You know, when you are editing the properties of a form field, you can set Default Text. This text is automatically inserted into the text field when the form is opened. I would like to make it so someone can type into the text field, but NOT change the default text inside the text field.

No, you're not making any sense at all - basically, all you are asking for is that you type in the text when creating the form, and then during the creation of the form you are saying it is read only to the person who is opening the form. That was the previous one I explained.

If they can not change the default text, then what is the purpose of typing into the field?

To me the purpose of the form itself is not making any sense at all. If you type in what you want the "default" text to say - you do that when creating the form. If you don't change the properties, it will show what is in the text field - they can type over it, but if they open the form again, it will still be there. It won't be deleted.

If they are using Acrobat reader, then they have to save a separate copy anyhow.

Those are the best ways to control a form in Acrobat when it comes to fields and other aspects of the form. However, if I have Acrobat Pro and you have no permissions (security) put on there - I can change anything I want.

Attached is a pdf form that does exactly what you are requesting, and it was not done with javascript but using the Acrobat function.

The default text does NOT change,, they can type over it... and whenever they open the form, it is still there.

It is based off of Acrobat reader - if you are using pro, I can definitely resave it with permissions and illustrate how you can save a file for that program and still prevent them from changing much of the form.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.