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.
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?
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.
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 "Other Date". Have an onChange event look to see if the "Other Date" 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.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.