Howdy all! Have a tricky question. Using LiveCycle ES 8.2
Working on a form, I've got a pair of linked text fields (global data linked).
These text fields are static in size, but I need the values typed into them to shrink when it fills up the visible area of the text field. I can't set the value font size to 0pt from the start. It makes the initial font size too big for the value. The font size needs to remain at 16 pt until the value fills up the field's visible area, then it needs to switch over to 0pt (hence triggering a full event).
I've tried using a full event with the following code;
But it won't fire. I wonder if there is a limitation to the what the full event can trigger. I can use the change event or even the exit event if I have to.
I've also tried a calculate event with the following script:
Using the script you gave me for the change event (xfa.resolveNode("TitleField0").rawValue = xfa.event.newText),
I decided to try a different approach. Since the change event on TitleField1 will now change the rawValue on TitleField0, I thought maybe if I put the following script in the change event on TitleField1 , it would trigger onto TitleField0 correctly. So far it hasn't, but maybe I'm writing it wrong?
if (form1.Card_order_form.Proof_card.TitleField1.rawValue.length < 36)
form1.Card_order_form.Proof_card.TitleField0.font.size = "9pt";
form1.Card_order_form.Proof_card.TitleField0.font.size = "0pt";
It does for the name fields. It's the title fields which are still troublesome.
After looking at it further, I wouldn't have an issue with making TitleField expand vertically to fit the multiple lines of text. The idea being to do what you said. Use the initial height of the field to limit the auto font size when the title is only one line, then have it expand to two lines when the title is long enough. Just not sure how to accomplish it. I've never used expand height to fit before.
Does my sample above work for you?
I tried both. Both those worked to copy the raw value from TitleField to TitleField without global data binding, but TitleField still won't change it's font size to 0 when the field is full.
I used the xfa.resolveNode("TitleField").font.size = "0pt"; on the full event of TitleField  with the limit to visible area option checked.
xfa.resolveNode("TitleField").rawValue = this.rawValue;
or this in the change event
xfa.resolveNode("TitleField").rawValue = xfa.event.newText
Yeah, TitleField and TitleField are both set to Use Global Data for their Data Binding. That way I can set TitleField to protected or Read-Only and have it populated with the data values from TitleField. Seeing as TitleField is populated via global data binding, is there another option I have to check to force TitleField's scripts to fire correctly?
Maybe, I didn't have that in my version.
Tried xfa.resolveNode("TitleField").font.size = "0pt"; in the full event on Title. Also checked the Limit length to visible area for both Title Fields  and . Still isn't firing. I'm wondering if it's because I have title field  populating title field  via global data binding between the 2?
Sorry should have been
xfa.resolveNode("TitleField").font.size = "0pt";
That's instance zero of TitleField, you will also need to have a Limit Length ... max chars or Limit Length to Visible Area set on TitleField
xfa.resolveNode("TitleField").font.size = "0pt";
Working better. But I wonder if I can write a script that is triggered on a full event for the Title field.
Then have the script execute something like:
this.font.size = "0pt";
I probably still not following, but with the "allow multiple lines" you can still get the auto fit thing happening.
Hopefully this will work this time, https://sites.google.com/site/livecycledesignercookbooks/home/bizcard_form.1.pdf?attredirects=0&d=1
Seemed to be something funny in the Imprint_header rich text before.
I think if someone has a long name and a short title, the name will be shrunk less than the title. Maybe you can +/- buttons for the users to adjust the font size manually.
Ahhh...I see what you're saying. My issue is more with the bottom field. [Title]
Just tried setting the font size to 0 in ES2. It does max the font size to the height of the field.
But with the bottom field, I only have so much room to work with. There are other fields below the Title field. So I can't set it to expand on demand.
What I've wanted it to do is hit a certain character limit (36), then switch from 9pt to 0 pt. But I have the "allow multiple lines" option checked in the object properties to allow the Title field to take up to 2 lines if necessary. I can't limit to a character count or visible area since it won't break onto multiple lines then.
Hence why I want to see if there's a change or full script that will change the font size to 0.
PS: I have the Title field on the left set to read only. It gets populated with its values from the title field on the right.
I think the maximum font size will be determined by the height of the field. This seems ok in your simplified version, is this not the case in the real form?
Still isn't opening up. I am running Reader XI and Acrobat 9 Pro (9.4) on my system. So I don't think either one should have any problems with compatibility.
So, in LiveCycle ES2, is there an option to change this reasonable maximum font size? Like can it be customized to a field, the whole form, or is it coded globally for all XFA PDFs?
Try this version of the form, is has the compatibility set to Reader 8. https://sites.google.com/site/livecycledesignercookbooks/home/bizcard_form.1.pdf?attredirects=0&d=1
There seems to be a reasonable maximum font, that is what I meant to point out in my first image above, which looks to me to be 9.5
Can't open the form. It gives me an "Error encountered while processing node...Unable to find a suitable font ISO 8859-6 encoding message. Both Reader and Acrobat.
In any event, if I were to use ES2 or later, and set the font value to 0, wouldn't the field value try and take up the entire text box then?
Using ES3 and just a 0 font initially (with all scripting removed) I get the following, for a short name;
Which seems about the right.
And for a long name
My version of your form is here https://sites.google.com/site/livecycledesignercookbooks/home/bizcard_form.1.pdf?attredirects=0&d=1
There have been some changes since ES8, including a default font size added to the form properties, but not sure that is a factor as the largest font used in this sample is still smaller than the default.
Is this what you are seeing?
Here's the dumbed down version.
Its the name and title fields which I'm trying to set the maximum font size to. There are two of each field, both have their values linked globally, but not their formatting. So, the left hand fields I need to set a different font size than the right hand fields.
How are you setting it though? What script?
I can't post the form without getting a bunch of OKs first (gotta love government).
But I will replicate the text fields I'm trying to do this in and post that in a pdf.
This might be something funny with ES 8. I have ES 9 and ES 10 and both seem to set the max font size to 12 points. If you can post a link to your form I can see what is happening in one of the newer versions.