Seeing the Entire Value

I’m sure many of you out there have run into problems with fields on printed forms where the value entered in the field was too long to fit within the field’s visible area. The result is a black “+” sign on the lower left corner of the field — not much help in reading the entire content when it’s printed and you can’t scroll anymore:

== ==

What if there was a way to configure the field so that the entered value’s font size would automatically shrink to fit the value within the field’s visible area (down to a certain limit)? Of course, it’s possible the text may end-up too small to read without a magnifying glass but the entire content would be printed nonetheless (as long as the minimum font size wasn’t hit):

== ==

The trick here is to set the field’s *value* font to a size of zero (0) but it’s not as obvious as it may seem…

In Designer, there are two ways to do this:

The first is to use script in the field’s Initialize event (FormCalc in this case but JavaScript would do just fine too):

bc. $.font.size = “0pt”

The second is to use the Font palette. In this case, however, only the *value* font’s size may be set to zero. Attempting to set the font size for the caption (or the caption and value combined) to zero won’t work. To specify the *value* font only, use the _Selector_ widget at the top (highlighted in green on the image below) and pick the _Edit Value_ item. Then, set the font size to zero (highlighted in yellow).

== ==

14 Responses to Seeing the Entire Value

  1. Zack says:

    Hi again Stefan,I’ve got another unrelated question you might be able to answer. I’m working with a signature field and want to hide it if it’s signed, but make it visible if it’s not signed. I already know how to hide and show, and I’ve seen topics on the forums for checking to see if the signature field is signed, but they all use something like:var f =“form1.subform1.signaturefield1”);They then check the status or the signatureInfo of this variable to make sure it’s greater than 2. (The defaults are set up so that 1 and 2 are invalid signatures, while 3 and 4 are valid). This seems to work fine for them, but I haven’t been able to even use the function. It just doesn’t show up in the list of fields and functions when I hit dot after target.Maybe they’re using FormCalc whereas I’m using javascript; I don’t really know. Any ideas or alternative solutions? Thanks,-Zack

  2. Zack,What they’re doing with the method is accessing the underlying AcroForm Field Object for the XFA field by asking the Acrobat Document ( for the AcroForm Field that matches the fully-qualified SOM expression they specify. I talk about this stuff in my earlier posting on AcroForm Objects.The reason why it may not be working for you is because you aren’t using a fully-qualified SOM expression to address your signature field. Assuming you have a simple object hierarchy on your form, the fully-qualified SOM for the signature field you wrote would actually be like this:”form1[0].subform1[0].signatureField[0]”Giving that to should get you an AcroForm Field object from which you can call the signatureInfo method in order to get the Acrobat SignatureInfo object which represents the signature. This object would then give you the information I think you’re after.To help you get the correct fully-qualified SOM expression for any object on your form, you can use the code from my AcroForm Field Name Generator post.Last of all, JavaScript must be used when accessing the Acrobat API. The reason why you don’t see a listing for “getField” when you add the dot (“.”) after “” is because the Object Assist window you get in only programmed to display XFA-related methods and properties. Since the “getField” method is a property of the Acrobat Document object, it doesn’t show-up in the list — hence my post on AcroForm Objects, which I encourage you to read.

  3. Thompson says:

    HiI’m trying to design the form for mail-merge function, but I’ve a problem. How can I control the length of sentence based on text field with pre-populated data (retrieve frm DB)?For example, the variables (text fields) are within the sentences of a paragraph, can the length of the sentences in letter paragraph be adjusted to fit after the pre-population of textfields?e.g.In design-time:”Forms have proven their flexibility in the %TF%. They are a familiar paradigm from the physical world, and it’s easy to structure form entries as machine-readable data.”Expected in run-time:”Forms have proven their flexibility in the physical world. They are a familiar paradigm from the physical world, and it’s easy to structure form entries as machine-readable data.”Since the DB field of the variable is varchar2(50), but I can’t set the textfield width equal to 50. Otherwise, many space would append to the the above “physical world”.Thanks

  4. Thompson,I think what you need to use is a Floating Field inside your paragraph.Floating Fields are typically used inside static text in order to inject values into a paragraph, for example, like the current date, a page number, etc.It’s also possible to bind a Floating Field to a data node in a data connection — which is exactly what you need to do since the data for the text that replaces the “%TF%” place-holder in your paragraph comes from a database.You would just need to place a text object on your form, set its text to be the paragraph you quoted (without the “%TF%” place-holder) and, once you’ve positioned the insertion cursor where the “%TF%” place-holder would go, insert a Float Field using the “Insert | Floating Field” top-level menu option.At this point, your paragraph will look something like, “… proven their flexibility in the {Text Field}. They are a…” Notice a text field has been inserted as a Floating Field inside the paragraph. Now, set the text object’s width and/or height to be expandable using the Layout palette so that if the inserted word should cause the text to reflow, the object’s boundaries will grow to accommodate the new length of the paragraph.Finally, select the Floating Field either by highlighting it in the paragraph or by selecting it in the Hierarchy palette (named “TextField1” by default) and bind it to the proper data node in your data connection to your data base.When you preview the form, the Floating Field’s value should be set to the value from the data connection and the paragraph should read, “… proven their flexibility in the physical world. They are a…”To help illustrate this concept, I’ve created a little sample form which uses data from an XML file to achieve the same thing:Download Sample [zip]Note: If you open this form in Acrobat, don’t forget to import the data into the form using the options under the “File | Form Data” menu.

  5. Cliff Malone says:

    Hi.I am a retired attorney that now has a web site that sells legal forms in pdf format. After purchase, test is typed by the user into field boxes and I want them to be expandable or shrinkable depending on how much text is inserted. In many legal documents, it is not acceptable to have blank lines and spaces. Is there an Adobe program or other software program that will do this? Remember the user will not tolerate anyting other than a simple and automatic procedure. For example, this final product would not be accpetable: “___Last Will of John Smith___”. It would have to shrink to fit as: “Last Will of John Smith”. Any thoughts? Thanks. Cliff Malone.

  6. Cliff,I think what you’re looking for is something slightly different from what I’m talking about in this post.XFA has a property you can specify on fields that says that their width and/or height is expandable. If you put a text field on a form and set its width to be “expand to fit” using the Layout palette, the field’s content area (where you enter its value) will automatically be extended to fit the value you enter into it.If you make the content area 1 inch wide and then enter “Last Will of John Smith” into it, assuming this takes more than 1 inch to display, the field will be extended just wide enough to fit the entire value completely.

  7. Eric says:

    I’m trying to create a text field in a html form. Currently I have This retrieves the exact contents of the field. Is there a way where a user can type a part of the data and still retrieve the whole thing? Thanks Eric

  8. Eric,Just for clarity, are you using LiveCycle Forms to render an XDP to an HTML document or is this just pure HTML you’re trying to do?Personally, it sounds like just pure HTML and you seem to be looking for a way to do some sort of word completion as a user starts entering a value into a text box.Is that right or am I totally missing the boat?

  9. Charles says:

    Hi,I have a question about floating fields. Is it possible to dynamically change the text in a floating text field without linking to an external datasource, such as an XML file? In short, I want to run this script on the click of a button.form1.mySubForm.myFloatingTextField.rawValue = “Text copied from a non-floating text field.”;My goal is to allow the user to change the text in floating text fields by entering info in non-floating text fields and clicking a button. Thanks!

  10. Charles,This is certainly possible but there are three very important things you need to know in order to get this to work properly:Floating fields are, by definition, hidden fields which are referenced by static text. That means that when you insert a floating field into a text object, an actual text field gets inserted into the form. If you look at the hierarchy tree in the Hierarchy palette after you insert the floating field, you’ll find an object with a name similar to “TextField”. You can change the name if you wish (e.g. to “myFloatingTextField”) to make it easier for writing scripts.Since floating fields are hidden (and should remain hidden), changing their value at runtime with script such as the one you suggested won’t trigger a repair to the form’s layout (because hidden objects don’t usually need to be rendered). Therefore, after setting its value, you must force the form to be re-rendered using thexfa.layout.relayout() statement (which works in both FormCalc and JavaScript). (The reason it works with data binding is because data binding generally occurs prior to the form being rendered so the floating field’s value shows-up correctly from the start.)You must preview and save your form as a dynamic form (e.g. “Acrobat 7.0.5 Dynamic PDF”) in order to be able to modify the content of a text object. In static PDF forms, text objects are rendered directly to the canvas as artwork and therefore cannot be modified as opposed to being actual objects in dynamic PDF forms.

  11. Joseph Moffatt says:

    Hi Everybody,Are there any other examples of floating fields out there?All I want to do is reproduce a text-field value from one page within a paragraph on a second page.Is it possible to do this:1) character by character? As the user inputs a character in the text field, it is reproduced within the paragraph?2) on mouseExit? When the user exits the text field, the value is reproduced within the paragraph?3) on submission? The value is reproduced within the paragraph when a submission button is clicked?Thanks in advance.

  12. Joseph,Displaying a value in a floating field at runtime is definitely possible.Unfortunately, I believe there’s a bug with floating field rendering where you must explicitly call


    after setting a floating field’s value in order to get the new value to be displayed within the text where the floating field is referenced. In my opinion, this update should occur immediately and shouldn’t require the entire form’s layout to be updated either.To update a floating field’s value on field’s mouse exit event, all you need is the following script in the field’s MouseExit event (although I would recommend using the Exit event instead since this also covers the user hitting the Enter key while focus is still in the field in order to commit its value as well as covering the Tab key when tabbing to the next field):

    FloatingField.rawValue = this.rawValue;xfa.layout.relayout();

    Note that the above script is in JavaScript but could be translated to FormCalc as well.In order to set a floating field’s value on the click of a button (could be regular or submit type), it’s just as easy: Just use the same script as above but place it in the button’s Click event.Finally, because of the fact that xfa.layout.relayout() must be called after an update to a floating field and that calling this method causes text in the field in which you’re entering characters to be highlighted, it’s not possible to update the floating field’s value as characters are entered. Essentially, you would only ever see the last character you typed.

  13. Joseph Moffatt says:

    Many Thanks Stefan.I’m getting to grips with floating fields now.One thing I noticed is that if a value is entered into a text field and then that field is hidden using the presence property, the value in the associated floating field is not hidden with it.Is there a simple way to resolve this?Thanks again.

  14. Joseph,You’re very welcome!Unfortunately, there’s no simple way to resolve the behaviour you’re observing.Floating Fields are, by definition, hidden fields which are referenced by text objects (<draw> nodes in XFA).Text objects only display the value of Floating Fields which they reference and therefore don’t have any dependence on those fields’ presence types (e.g. visible, invisible or hidden).