My form had two objects: A button and a text field (named TextField1). The script I last posted was on the button's Click event as FormCalc.
In the underlying XML, the field (TextField1) looks like this by default (I'm skipping stuff that isn't important in this case):
<field name="TextField1">
<caption>
<value>
<text>Text Field
</value>
</caption>
</field>
When trying to access the field's caption, you need to get the value of the caption's text element.
The
#text property is accessing the <text> element contained within the caption's value element. In this case, you could probably simply use
TextField1.caption.value.text = "test"
and get the same results (without the "#" prefix). The use of "#" as a prefix on the
text property forces the scripting engine to look for an attribute or element by the name of "text" instead of first looking for a form object named "text". When you know that there's a specific attribute or element you're trying to access and it has the same name as an object on your form, it's safer to prefix the attribute/element name with "#" to ensure you get desired results.
Stefan
Adobe Systems