Bug Tracker

Changeset 5657

Show
Ignore:
Timestamp:
05/22/08 09:32:47 (3 months ago)
Author:
joern.zaefferer
Message:

autocomplete: Removed the blur-on-return workaround, added a less obtrusive one only for Opera

Location:
trunk/plugins/autocomplete
Files:
4 modified

Legend:

Unmodified
Added
Removed
  • trunk/plugins/autocomplete/changelog.txt

    r5633 r5657  
    44* Fixed ac_even class (was ac_event) 
    55* Fixed bgiframe usage: now its really optional 
     6* Removed the blur-on-return workaround, added a less obtrusive one only for Opera 
    67 
    781.0 
  • trunk/plugins/autocomplete/demo/index.html

    r5475 r5657  
    241241            </select> 
    242242        </p> 
     243         
     244        <input type="submit" value="Submit" /> 
    243245    </form> 
    244246     
  • trunk/plugins/autocomplete/jquery.autocomplete.js

    r5633 r5657  
    7979    var select = $.Autocompleter.Select(options, input, selectCurrent, config); 
    8080     
     81    var blockSubmit; 
     82     
     83    // prevent form submit in opera when selecting with return key 
     84    $.browser.opera && $(input.form).bind("submit.autocomplete", function() { 
     85        if (blockSubmit) { 
     86            blockSubmit = false; 
     87            return false; 
     88        } 
     89    }); 
     90     
    8191    $input.keydown(function(event) { 
    8292        // track last key pressed 
     
    124134            case KEY.TAB: 
    125135            case KEY.RETURN: 
    126                 if( selectCurrent() ){ 
    127                     // make sure to blur off the current field 
    128                     if( !options.multiple ) 
    129                         $input.blur(); 
    130                     event.preventDefault(); 
     136                if( selectCurrent() ) { 
     137                    // stop default to prevent a form submit, Opera needs special handling 
     138                    if (!$.browser.opera) 
     139                        event.preventDefault(); 
     140                    else 
     141                        blockSubmit = true; 
    131142                } 
    132143                break; 
     
    186197        select.unbind(); 
    187198        $input.unbind(); 
     199        $(input.form).unbind(".autocomplete"); 
    188200    }); 
    189201     
  • trunk/plugins/autocomplete/todo

    r5336 r5657  
     1- multiple + mustMatch: incorrect value deletes more then just the incorrect value -> delete only the last value 
     2- multiple without mustMatch: incorrect value + seperator inserts last match -> don't 
     3 
    14 
    25TODO