Jump to content

how to put <input type="text" /> into <option>?


FeFe
 Share

Recommended Posts

I am new in JS on the web atleast, becasue I wrote several JS for InDesign and I tought I try something simple for the web which probably is simple for the one knows it how. I was googling for a while with no success and I was also looking several forums with no success.I want to make the last item of an List editable (like the <input />) for "Custom" basically so the user can type his text.Is that possible somehow in JS with an onChange event or it can be acomplished with simple HTML code if so can someone give me a sample code of it?Thanks. Ferenc

Link to comment
Share on other sites

Something I've seen in a lot of forms is an alternative to what you're suggesting. First, you'd have a radio button next to a select element. Second, below those, you'd have a radio button next to a text input. The two radio buttons work together, so by choosing one, you're user is telling you she wants EITHER the selected option OR whatever's typed in the text element.Then, in your CGI, you'd test which radio button is selected, and that would tell you whether to use data from the select option or data from the text element.

Link to comment
Share on other sites

Hi Deirdre's Dad,Thanks for the fast reply.

Something I've seen in a lot of forms is an alternative to what you're suggesting. First, you'd have a radio button next to a select element. Second, below those, you'd have a radio button next to a text input. The two radio buttons work together, so by choosing one, you're user is telling you she wants EITHER the selected option OR whatever's typed in the text element.Then, in your CGI, you'd test which radio button is selected, and that would tell you whether to use data from the select option or data from the text element.
I do not know anything about CGI scripting/programming and I actually wanted to solve this with only JS as i know its syntax a bit more (not have much experience in JS for the web) than to start learn CGI scripting. Is there would be a way to position an hidden text box above the area of the Dropdown with JS when the "Custom" is selected from the list and when the user change the value and hit Enter than hide the text box and change the Custom to whatever the user typed?? Is this can be done? How?Ferenc.
Link to comment
Share on other sites

In the meantime I figured out a solution. Is not exactly I wanted, but it does what I wanted and only by using JS and simple HTML tools. Here is:Have a text box shown, than beside there is a button with either an image of an arrow or an text like "List".When user click on the button, an hidden Table is shown and when the user selet one row, than the value goes into the text box and than the table is disappear.Thanks the attention anyway!Ferenc :)

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...