1 Reply Latest reply on Jun 29, 2011 9:46 AM by dhoult

    Change value of textbox that currently has focus

    dhoult

      My question is similar to another one of my posts, but it's a little more specific.

       

      Assume I'm typing in a text box, and the fieldFull event is triggered.  I would like to change the text in that text box.

      The Acrobat scripting guide gives the following example for fieldFull:

       

           if ( event.fieldFull )
           {
                app.alert("You've filled the given space with text," 
                + " and as a result, you've lost some text. I'll set the field to" 
                + " scroll horizontally, and paste in the rest of your"
                + " missing text.");

       

                this.resetForm([event.target.name]);     // Reset field to lose focus
                event.target.doNotScroll = false;        // Make changes
                event.change = event.changeEx;
           }

      This example doesn't work consistently and has the annoying habit of occasionally resetting the field without changing the data.

      In addition, I don't want all the data in the box - I'd like to cut it off.  It's easy enough for me to store in a variable all the data I'd like to put in the text box; the problem is actually changing the text box value programmatically.  I've tried setting focus to another field and then changing the value, resetting the form and then changing the value, etc., but I always get an InvalidSetError:  Set not possible, invalid or unkown.

       

      Any ideas?