Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

FORM FIELD: How to expand/contract list view

Status
Not open for further replies.

guava65

Programmer
Jul 20, 2001
238
0
0
US
I am trying to create a form where one field is a single character (A,B,C,D). The characters represent a code for a type of business. for example:

A = Word of Mouth
B = Walk-in
C = Referral
D = Advertisment


I would like to use a combo-box (so some equivalent) to show the code and the description but only return the code as a single text character.

I haven't been able to do this. So far, the only way I can show the code and description is to make the box the width of the widest selection. The problem is the form only accepts a sigle character in that space.

How can I display the full description and only return the single character to the form? Aloha,
cg
 
I've accomplished something similar by having two fields - the drop down list with one name and a separate read-only text field with the name of the code I want to obtain. Whenever the user selects something from the drop down I programatically fill in the text box. If this will work for you try this code:

In an onBlur for your combo box:

var fieldToChange = this.getField("codeTextBox");

if (event.value == "Select one from list") {
fieldToChange.value = "";
} else {
fieldToChange.value = event.value;
}

In the example above, "Select one from list" is the first item in my drop down list so if it's selected, I want to empty out the code field. Even though the export value is null for that item it still works properly.

Good luck!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top