Export to GitHub

ufd - issue #4

create an option firstEmpty to automatically create an empty element as first element


Posted on Dec 18, 2009 by Happy Rabbit

It would be nice to create an option like firstEmpty : true

(which maybe by default is false) to automatically create a blank <option> on the top of the select on UDF init.

Comment #1

Posted on Dec 19, 2009 by Happy Rabbit

If you want, i can try to make a patch for this

Comment #2

Posted on Jan 20, 2010 by Massive Rhino

It's not very wise. The purpose of this plugin - to "decorate" the existing without modifying it's standard behaviour (let's ignore filtering for a minute). So it's 1. not a defect, 2. it's better to add an "Select something" in the server-side code, rather than increasing complexity with this feature. 3. the right implementation would be not adding a new option, but just modify function "setInputFromMaster" to make it set "this.input.val('');" if an option is set.

Comment #3

Posted on Feb 4, 2010 by Massive Ox

Doing this is in effect adding a new option element, as the list is backed by and reflects the real select list; this is the "unobtrusive" part of the name.

If you want the user to be able to submit an empty value - add it in the original. You can then have a value submit (e.g. ) and your server can interpret it as needed.

if you really want clientside to add the empty value, just do this:

$("select").prepend("");

Status: WontFix

Labels:
Type-Defect Priority-Medium