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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

< select > limited to list, but only one choice 1

Status
Not open for further replies.

MikeT

IS-IT--Management
Feb 1, 2001
376
US
I have a select that I want to suggest values to the user, but I don't want to make them choose from the list I give them. They can only choose one option, be it ane already in the list, or one they type in themselves.
 
Use an onChange() event in both the select box and the text field. Once the select box is changed the text field value is blanked and vice versa. That way they will only be able to enter a value in either the select or the text box.

Is that what you are trying to do? Mise Le Meas,

Mighty :)
 
I appreciate your posts; but I guess I wasn't clear enough.
If you are framiliar with Access forms, you can can create a combo box and specify whether or not the user is 'limited to the list' as far as choices; ie they can choose from the list just like a regular combo, or they can enter their own info as if it were a textbox.
Am I being clear?
 
MikeT,

Jaredn's suggestion would work in this case.
Did you check out his combobox? Mise Le Meas,

Mighty :)
 
Aye, but understand I don't want the user to be able to add elements to the <select>. I just want them to be able to type them in if it isn't in the list.
 
Use an onChange event in the select list to put the selected item into the textbox, or allow them to fill in the textbox themselves, then use only the value of the textbox. Tracy Dryden
tracy@bydisn.com

Meddle not in the affairs of dragons,
For you are crunchy, and good with mustard.
 
so that's just jaredn's combo, but you have to add a test on change (for the text box) : if the value entered is in the list, alert the user or select the existing value or whatever, if it's not, fine, go on ! if you want to catch the input very soon (say ... for the 3 first letters ... ;]) use onfocus or ontype (not sure at all about the last !)...

should be easy as you have both the list and the input value !!!
 
Thats a good Suggestion tsdragon, and I may endup using it. Let me explain from the beggining.
OK, here we go:
My users need to select a date.
This date is always a Sunday, and usually within the last 2 months. I've created a dropdown that will show the last 8 Sundays based on the current date, and in the form of xx/xx/xxxx. I give them a list so they dont accidentally input 5/7/01 when they really mean 5/6/01. Sometimes they need to go way back, and in that case I'm trusting them to input the correct date. However, I'm not putting in an entry for every Sunday of the year. So, I want them to be able to type the date right into the <select>, as if it were a text box. I don't want to put another text box on the page.
 
Mike, there isn't a normal form control that gives you that sort of flexibility. You might find something on the JavascriptSource website ( that will do what you want.
Tracy Dryden
tracy@bydisn.com

Meddle not in the affairs of dragons,
For you are crunchy, and good with mustard.
 
Wow; I thought there was a limittolist=no attribute or something for <select>s. I know there is in MS Access forms, I probably just got too optomistic. Well, thanks for the posts, it was a heck of ride.
 
I think I might have your answer. I have the same thing on a site of mine. Have your list box with your sundays in it and add an option tag for &quot;Other Date&quot;. Have an onChange event look to see if the &quot;Other Date&quot; was selected and then use the prompt tag to ask the user for the desired date. You can then use that date and even validate it before processing. I think I covered the bases. You didn't want them to modify the list box nor did you want another text field.
 
I've never used the prompt tag before (!). What is the syntax?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top