Good morning all,
I'm new here, and new to JavaScript. I've been working on creating an interactive PDF document for several days now. I feel I have come a long way, simply reading the developer document using Google to find things I didn't understand, but I have reached an impasse.
I have a combo box that I am using to populate other text fields in the document, and thanks to nerdaggro and Thomp in another forum post, I got one of the fields to act exactly the way I wanted it to. I now have another field that I want to have set as readonly, so long as the user selects an input already available in the combo box, with values pulled for that selection. But if the user decides to type something different into the combo box, then I need the related field to become non-readonly and allow the user to imput his own data at that point.
What I currently have is what Thomp gave to nerdaggro in the previous post I mentioned. I've tried to modify it to add the removal of the readonly, to no avail.
I have a Text Field named "txtClass_Value". In the Custom Keystroke Script: Under the Format tab of the Text Field Properties window, I have:
if (!event.willCommit)
{
event.target.bDetect = true;
}
else if (event.value == "")
{
event. target.bDetect = false;
}
in the Custom calculation script: Under the Calculate tab of the Text Field Properties window, I have:
event.rc = !event.target.bDetect;
event.value = this.getField("cmbClass").value;
var A = this.getField("cmbClass").value;
if (A == "Select_1")
event.value = 12
else if (A == "Select_2" || A == "Select_3")
event.value = 10
else if (A == "Select_4" || A == "Select_5")
event.value = 8
else
event.value = ""
This Text Field is set to readonly using the check box found on the General tab. I've tried using:
this.getField("txtClass_Value").readOnly = false;
This has proved fruitless though, and no matter where I place this, I do not end up with what I am after. I'm really hoping that my question makes sense to someone out there, and that they are willing to assist me in this matter. I know I could just leave the fields set as not readonly, but then that adds a field that I may not want the user modifying, based on another selection. Maybe I'm trying to do this in the wrong location, or maybe I need it to be an action of some sort, I'm beyond my element now on this one.
Thanks again, in advance, for any help you may offer
this.getField("txtClass_Value").readonly = false;
It's always to simple stuff;)
Thom Parker
The source for PDF Scripting Info
www.pdfscripting.com
Very Important - How to Debug Your Script