Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.
SOLVED

Auto Completion script Issue

Avatar

Level 7

Is it possible to populate into a text field the value form a Drop box after selecting the desire item from the list Box.

I am try to modify From J.P.Terry e-seminar(The Auto Completion sample) without any luck!

May I send a sample  for you to look....

Thanks very much

1 Accepted Solution

Avatar

Correct answer by
Level 10

In your form you have attached an XML file to the preview and populating the listbox form the XML.

While adding items to the listbox you are not setting values to it. You are only adding display names.

I changed the change event code in fullName field to have the additional parameter and changed the XML to have one additional tag. Use this XML for your testing..

nameList.addItem(sform1Objs.item(m).Department.value, sform1Objs.item(m).DepartmentCode.value);

<?xml version="1.0" encoding="utf-8"?>
<form1>
  <RecordItem>
<DepartmentCode>1</DepartmentCode>
    <Department>A</Department>
  </RecordItem>
  <RecordItem>
<DepartmentCode>2</DepartmentCode>
    <Department>A1</Department>
  </RecordItem>
  <RecordItem>
<DepartmentCode>3</DepartmentCode>
    <Department>A2</Department>
  </RecordItem>
  <RecordItem>
<DepartmentCode>4</DepartmentCode>
    <Department>A3</Department>
  </RecordItem>
  <RecordItem>
<DepartmentCode>5</DepartmentCode>
    <Department>B</Department>
  </RecordItem>
  <RecordItem>
<DepartmentCode>6</DepartmentCode>
    <Department>B1</Department>
  </RecordItem>
</form1>

Updated form is below..

https://acrobat.com/#d=xhcLuu*TTUzIlk7fmffjDA

Thanks

Srini

View solution in original post

6 Replies

Avatar

Level 4

mmgiath,

Could you please mail me the samplesFile.zip

Avatar

Level 10

In your code,  in the exit event in the hidden Listbox you are setting the value to dropdown instead of TextField.

Change the code as below.

 

if (this.rawValue != "" && this.rawValue != null)

     TextField1.rawValue = this.rawValue;

Will this resolve your issue? Let me know a scenario how you want to to work?

Thanks

Srini

Avatar

Level 7

Hi Shrini,

I do not think explain my issue well...I apologize..

I want to populate the value of the fullName Drop Box (for example 1 or 2  or 3 or....depend what item user pick from the Drop box) into  TextField1.

My scenario is I have to include few hundred items into the dropBox and I will use the hidden List(When user types first letter)  to find easy the item they look for!

For each item we have a different code. We like this code to populate the TextField1.

THANKS

Avatar

Correct answer by
Level 10

In your form you have attached an XML file to the preview and populating the listbox form the XML.

While adding items to the listbox you are not setting values to it. You are only adding display names.

I changed the change event code in fullName field to have the additional parameter and changed the XML to have one additional tag. Use this XML for your testing..

nameList.addItem(sform1Objs.item(m).Department.value, sform1Objs.item(m).DepartmentCode.value);

<?xml version="1.0" encoding="utf-8"?>
<form1>
  <RecordItem>
<DepartmentCode>1</DepartmentCode>
    <Department>A</Department>
  </RecordItem>
  <RecordItem>
<DepartmentCode>2</DepartmentCode>
    <Department>A1</Department>
  </RecordItem>
  <RecordItem>
<DepartmentCode>3</DepartmentCode>
    <Department>A2</Department>
  </RecordItem>
  <RecordItem>
<DepartmentCode>4</DepartmentCode>
    <Department>A3</Department>
  </RecordItem>
  <RecordItem>
<DepartmentCode>5</DepartmentCode>
    <Department>B</Department>
  </RecordItem>
  <RecordItem>
<DepartmentCode>6</DepartmentCode>
    <Department>B1</Department>
  </RecordItem>
</form1>

Updated form is below..

https://acrobat.com/#d=xhcLuu*TTUzIlk7fmffjDA

Thanks

Srini