Expand my Community achievements bar.

Learn about Edge Delivery Services in upcoming GEM session

Text field auto suggestion!

Avatar

Level 2

i want to create auto suggestion for a text field.

As user type  charcter(s) in the text field it will show the list of words to be selected.

I have no idea how can i do it?

Any help?

thanks

Faraz

5 Replies

Avatar

Former Community Member

As far as I know this is only possible with drop-down lists.

Avatar

Level 2

How to do it with drop down list?

Avatar

Level 10

Hi,

The only thing I can think of is to use the change event and look at the newText as the user types in each letter. This would require you to hard code in the suggested text, in this case it will revert to the single choice available depending on how many letters are required. For example:

app = apple

apr = apricot

pear = pear

peac = peach

pl = plum

It depends on how complex your list is, as to whether this approach is worth it.

Good luck,

Niall

ps There seems to be a problem with files being queued. Hope fully it will get released. In any case this is the javascript in the change event of TextField1. There is a second TextField2 to set the focus onto.

var result = xfa.event.newText;



switch (result)


{


     case "app":


     xfa.host.setFocus(xfa.form.form1.page1.TextField2);


     xfa.host.resetData("xfa.form.form1.page1.TextField1");


     this.rawValue = "apple";


     break;


     


     case "apr":


     xfa.host.setFocus(xfa.form.form1.page1.TextField2);


     xfa.host.resetData("xfa.form.form1.page1.TextField1");


     this.rawValue = "apricot";


     break;


     


     case "pear":


     xfa.host.setFocus(xfa.form.form1.page1.TextField2);


     xfa.host.resetData("xfa.form.form1.page1.TextField1");


     this.rawValue = "pear";


     break;


     


     case "peac":


     xfa.host.setFocus(xfa.form.form1.page1.TextField2);


     xfa.host.resetData("xfa.form.form1.page1.TextField1");


     this.rawValue = "peach";


     break;


     


     case "pl":


     xfa.host.setFocus(xfa.form.form1.page1.TextField2);


     xfa.host.resetData("xfa.form.form1.page1.TextField1");


     this.rawValue = "plum";


     break;


}

Avatar

Former Community Member

There is also an auto-complete feature in Acrobat that can be turned on. Look under Edit/Preferences at the Forms option. There is a setting for Auto Complete that can be turned on.

Paul

Avatar

Former Community Member

Attached is an example of what I was referring to with regards to the drop-down list. Although I think Niall's post is more specific to what you are wanting to do.