Parabellum1905y / ufd

Automatically exported from code.google.com/p/ufd
GNU General Public License v2.0
0 stars 0 forks source link

Clearing Text Selects No Value Option (Enhancement) #42

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
Just an enhancement that I'm using. Thanks for the great control.

Use empty value option at the top of drop downs that are optional (with or 
without some helper text - e.g., "Select one of the following..."). The changes 
below the selection to be reset to the first non-value option by clearing the 
text and tabbing off the drop down (currently it reverts to the previously 
selected value and isn't as key board only friendly).

Enhancement applies to ufd 0.6.

1. filter method (line 413) - passing search text along:

self.updateOnTimeout = setTimeout(function() { screenUpdate(searchText); }, 
self.options.delayYield); 

2. filter screenUpdate function (line 417):

var screenUpdate = function(searchText) {   

3. filter screenUpdate function (line 439):

if (!oldActiveHidden && active.length && self.trie.matches.length && 
(searchText != "" || self.selectbox.get(0).options[0].value != "")) {  

Original issue reported on code.google.com by kbai...@mdsc.com on 20 Jan 2011 at 4:49

GoogleCodeExporter commented 8 years ago
Yep might be nice, although how is this done on the native element underneath? 
Is it assuming that the 0-th item is non-selectable?

Original comment by thetoolman on 21 May 2012 at 6:29

GoogleCodeExporter commented 8 years ago
For the native control, it just assumes the 0-th element is the "none selected" 
option (e.g., <option value="">Select an item...</option>) and then my server 
side validation on the post verifies that there is a value for the select list.

Original comment by kbai...@mdsc.com on 21 May 2012 at 6:59