Copy link to clipboard
Copied
Hi,
I'm wondering if it's possible to access the complete set of form field text properties with Javascript.
The basic set is available under the Field object, but I'm looking for the other stuff that is available specifically for rich text fields, such as the following paragraph properties:
Indents (left and right, first line indent, hanging indent), vertical alignment (top, bottom, middle), space above and below, and leading (line spacing).
All this stuff is available if you place your cursor in a rich text field and hit Ctrl-E to open the Form Field Text Properties, and then click on "More".
So I'm wondering if it's also accessible via JS, because I can't find anything in the documentation about it.
Many thanks for any help!
Ariel
1 Correct answer
Some rich text properties are available, but not the ones you mentioned,
I'm afraid.
Study the Span object to find out which ones are.
Copy link to clipboard
Copied
Some rich text properties are available, but not the ones you mentioned,
I'm afraid.
Study the Span object to find out which ones are.
Copy link to clipboard
Copied
Thanks, that's what I was afraid of.
Copy link to clipboard
Copied
If I remember correctly, there are a few undocumented properties in the spawn object; you might access one from the console and use the for…in statement to get an overview of what is actually available.
Copy link to clipboard
Copied
Thanks, that's a good idea. I didn't get very far with it, though.
Running this:
f = this.getField("Text Field 1").richValue[0]
for (i in f){
console.println(i);
}
Only produced this list:
alignment
fontFamily
fontStretch
fontStyle
fontWeight
text
textColor
textSize
All of which are documented.
And modifying the first line to:
f = this.getField("Text Field 1").richValue[0].constructor;
was even less helpful, returning:
function Object() {
[native code]
}
I'm not convinced I'm getting to the actual Span object itself this way, though.
Am I missing anything?
Copy link to clipboard
Copied
This is definitely the right direction.
I must admit that it is quite some time ago that I did it, but I got a few more properties… gimme a bit of time to dig up the code.
You might try to set some more properties via user interface.
Also, in order to get the values, you could use this line of code:
console.println(i + " " + f) ;
Copy link to clipboard
Copied
If you can find your old code, that would be great.
I tried setting some extra properties via the UI (double line spacing, indent), but didn't see anything new when rerunning the script. Good idea though.
Copy link to clipboard
Copied
maxwyss wrote:
I must admit that it is quite some time ago that I did it, but I got a few more properties… gimme a bit of time to dig up the code.
Any luck? It would still be very helpful for me.
Thanks,
Ariel

