Handling "other" option in dropdown select with free text input field

Posted by ted776 on Stack Overflow See other posts from Stack Overflow or by ted776
Published on 2010-05-06T16:10:42Z Indexed on 2010/05/06 16:28 UTC
Read the original article Hit count: 161

Filed under:
|
|

Hi, I'm trying to figure out the best way to handle a dropdown list where one of the options "other" shows a hidden text field (via jQuery), where the user can then enter text. Should both the dropdown and the input field be given the same "name" attribute, then server side code runs a check on the values of each in order to know what one is the active value - e.g if the value of the select box is "other", then check the value of the text input field - if this isn't the default value ("enter text"), then it's ok to use this value and save it to the database. Is this a messy approach to this problem?

© Stack Overflow or respective owner

Related posts about web-development

Related posts about jQuery