These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

Trouble changing text field '.value' property in Acrobat JavaScript

gaia88
Registered: Jun 24 2009
Posts: 14
Answered

I am attempting to change the text that displays in a text box by setting its '.value' property. Here's the relevant code:

seller = this.getField("topmostSubform[0].Page1[0].seller[0]");
seller.value = "new value";

The text in the text box doesn't change and I get the following error in the JS console:

InvalidSetError: Set not possible, invalid or unknown.
Field.value:107:App Clauses:Exec

Any ideas?

- Nate

My Product Information:
Acrobat Pro 9.0, Windows
gkaiseril
Online
Expert
Registered: Feb 23 2006
Posts: 4307
Obviously you are using LiveCycle Designer, so the AcroForms JS syntax needs to be adjusted for LiveCycle Designer's syntax.
topmostSubform[0].Page1[0].seller[0].rawValue = "new value";

George Kaiser

gaia88
Registered: Jun 24 2009
Posts: 14
Does it matter that the PDF with this code will eventually be rendered in Reader?
Dimitri
Expert
Registered: Nov 1 2005
Posts: 1389
Hi gaia88,

No, that is not a problem. PDF forms created in either Acrobat or LiveCycle Designer will render fine in Adobe Reader- it's designed to work that way. One caveat is that if you use new features in your PDF then the users sometimes will need to get a later version of the free Adobe Reader in order to use those- an example is the new Portfolios introduced in Acrobat 9- when those are opened in earlier versions of Reader you don't get all the fancy effects portfolios offer.

Hope this helps,

Dimitri
WindJack Solutions
www.pdfscripting.com
www.windjack.com
gaia88
Registered: Jun 24 2009
Posts: 14
Thanks for the replies. I've done some more work on this and have more information. As before, I have a text box on my PDF called "seller". Here's a code sample:

seller.rawValue = 'text';
app.alert(seller.rawValue);

The alert shows the new value of the seller text box ("text"), but the actual text in the text box on the PDF does not change. Am I missing something?

- Nate
gkaiseril
Online
Expert
Registered: Feb 23 2006
Posts: 4307
Have you exited the field?

George Kaiser

gaia88
Registered: Jun 24 2009
Posts: 14
I did...that made no difference.

- Nate
gaia88
Registered: Jun 24 2009
Posts: 14
I'm glad someone from WindJack replied because this is actually something I'm trying to do with two of their components (AcroDialogs and AcroButtons). If I assign a value to seller.rawValue in a JavaScript event by itself it works fine. But where I'm having trouble getting it to work is in the AcroDialogs/AcroButtons code. What I'm trying to do with these two components is this:

1) AcroButtons button appears when the form is loaded (works fine).
2) User clicks the button. AcroDialogs drop down pops up. User selects an item and clicks "OK". (this also works fine)
3) In the AcroDialogs code that fires off when the user clicks OK ( if("ok" == clauses.DoDialog()) ), I get the value that the user selected. (this part also works fine)
4) Also in that section of AcroDialogs code, I try to assign the return value to the .rawValue of a text box. This, for some reason, does not work.

Any input from WindJack on this issue would be highly appreciated.

- Nate
musmanlatif
Registered: Jun 26 2009
Posts: 1
No, that is not a problem. PDF forms created in either Acrobat or LiveCycle Designer will render fine in Adobe Reader- it's designed to work that way. One caveat is that if you use new features in your PDF then the users sometimes will need to get a later version of the free Adobe Reader in order to use those- an example is the new Portfolios introduced in Acrobat 9- when those are opened in earlier versions of Reader you don't get all the fancy effects portfolios offer.


Eyewear Frames
http://www.frames4sale.com/
gaia88
Registered: Jun 24 2009
Posts: 14
The ultimate solution was to assign the value like this:

this.xfa.form.topmostSubform.Page1.seller.rawValue = clauses.clause.toString();

- Nate
andrew84125
Registered: Aug 10 2009
Posts: 1
It is nice to see that you have found solution of your problem. Otherwise I would help you to solve this

[url=http://www.coasttocoastlimousine.com/]New York Limousine[/url]

[url=http://www.coasttocoastlimousine.com/]New York Limousine[/url]