Changeset 1378

Show
Ignore:
Timestamp:
20/11/09 16:22:10 (3 months ago)
Author:
karel
Message:

On blur, restore the last selected value in the input box - this avoids users accidentally clicking away and forgetting about the control. TODO: allow clearing the field if nullable

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/modules/kauri-forms/kauri-forms-extra/src/main/kauri/static/autocomplete/js/autocomplete.js

    r1377 r1378  
    4343 
    4444    AutocompleteControl.prototype.initElements = function(create) { 
    45         this.$acinput = kf.ControlElements.lookup(this, "acinput", true); 
    46         this.$acinput.focus(function() { 
    47           this.select(); 
    48         }); 
    49  
    5045        var me = this; 
    5146         
     
    5348        this.listTemplate  = new kp.UriTemplate(this.listTemplate, {skipEscape: true}); 
    5449         
     50        this.$acinput = kf.ControlElements.lookup(this, "acinput", true); 
     51        this.$acinput.focus(function() { 
     52          this.select(); 
     53        }); 
     54        this.$acinput.blur(function() { 
     55          me.$acinput.val(me.inputTemplate.expand(me.getValue(), true)); 
     56        }); 
     57 
    5558        var jqOptions = { 
    5659          dataType: "json",