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

value.length not working ...

lesliestoudt
Registered: Sep 14 2009
Posts: 8

Hey there.

I have some code that is stripping specific characters from an existing field.

In this code, I do the following

var sValueLen = sValue.length;

Now, sValue is 123123123. (I do an app.alert and see that)
However, sValueLen is undefined.

??????

Ideas? What am I doing wrong? What is amiss?

My Product Information:
Acrobat Standard 8.1.6, Windows
try67
Expert
Registered: Oct 30 2008
Posts: 2398
Try accessing valueAsString instead of value

- AcrobatUsers Community Expert - Contact me personally at try6767 [at] gmail [dot] com
Check out my custom-made scripts website: http://try67.blogspot.com

gkaiseril
Online
Expert
Registered: Feb 23 2006
Posts: 4307
'valueAsString' is a property of the field object. If sValue is just a string variable, you may need to use the JS 'toString()' method.

George Kaiser

try67
Expert
Registered: Oct 30 2008
Posts: 2398
I know. I meant that instead of setting sValue using this.getField("whatever").value he should use this.getField("whatever").valueAsString

- AcrobatUsers Community Expert - Contact me personally at try6767 [at] gmail [dot] com
Check out my custom-made scripts website: http://try67.blogspot.com