Please login or register.

Login with username, password and session length
Advanced search  


You need/want an older version of sNews ? Download an older/unsupported version here.

Author Topic: Q:How to make <select> take new entry  (Read 3294 times)


  • High flyer
  • ULTIMATE member
  • ******
  • Karma: 161
  • Posts: 1988
    • fiddle 'n fly
Q:How to make <select> take new entry
« on: November 25, 2007, 02:14:30 am »

I would like to be able to add(ie, type it in) to a 'dropdown' a new entry, which then would be accepted by the php processing script.

Now, by reserving the first option
<option value="0">New Entry</option>
I have the means to check if it as altered from default.. ie, test if select[0]=="New Entry"
So I sortof know how to process...

My problem is getting the select element to accept keyboard entry.

Clues anyone?
Of all the things I have lost, it is my mind that I miss the most.

Fred K

  • Still trying to learn stuff
  • ULTIMATE member
  • ******
  • Karma: 130
  • Posts: 2728
    • Personal
Re: Q:How to make <select> take new entry
« Reply #1 on: November 25, 2007, 07:35:47 am »

You'd probably need a text field in the <option>
<option bla="bla bla" id="new_entry" name="new_entry"><input type="text" name="new_entry" id="new_text" value="Put. Text." /></option>
with a submit onclick. I think. Not sure it's even allowed, I think it might not be, but something like that might do it.
W3Schools has more on <option>.


  • Full Member
  • ***
  • Karma: 8
  • Posts: 106
    • sNews 1.6 in Danish
Re: Q:How to make <select> take new entry
« Reply #2 on: November 25, 2007, 11:22:07 am »

Hmmm.. how about using e.g. prototype?

Disable / enable an input field depending on select state? I think it makes more sense to do it that way than re-inventing the HTML form element ;) Possibly you would also want to provide the user with extra info on how to fill out the field and so on, info which would not be needed if they pick an existing category.

Simple example here:

You can ofc check prototype/sciptaculous/jQuery APIs documentation also but bit more work involved in that approach :)


"Opportunity is missed by alot of people because it comes dressed in blue overalls and looks like hard work" -- Thomas Edison (1847-1931)