diff --git a/CHANGELOG.txt b/CHANGELOG.txt
index f3cd357..fbbe151 100644
--- a/CHANGELOG.txt
+++ b/CHANGELOG.txt
@@ -4,6 +4,7 @@ X-editable changelog
 
 Version 1.3.1 wip
 ---------------------------- 
+[enh #47] set select source to function (brianchance) 
 [bug] fix inline container move on next line in IE7 (vitalets) 
 
 
@@ -59,8 +60,8 @@ Version 1.1.1 Nov 30, 2012
 [enh #13] 'onblur' option: to cancel, submit or ignore when user clicks outside the form (vitalets)  
 [enh] 'ajaxOptions' parameter for advanced ajax configuration (vitalets)  
 [enh] 'success' callback can return object to overwrite submitted value (vitalets)  
-       
-       
+	   
+	   
 Version 1.1.0 Nov 27, 2012
 ----------------------------   
 [enh #11] icon cancel changed to 'cross' (tarciozemel)  
@@ -70,7 +71,7 @@ Version 1.1.0 Nov 27, 2012
 [enh] form template changed: added DIV.editable-input, DIV.editable.buttons and $.fn.editableform.buttons (vitalets)      
 [enh] new input type: checklist (vitalets)      
 [enh] updated docs: inputs dropdown menu, global templates section (vitalets)      
-                            
+							
 
 Version 1.0.1 Nov 22, 2012
 ----------------------------          
@@ -79,8 +80,8 @@ Version 1.0.1 Nov 22, 2012
 [enh #1] params can be a function to calculate it dynamically (vitalets)         
 [enh #6] do not preventDefault() in click when toggle='manual'. This allows to have clickable links (vitalets)
 [bug #3] should not mark element with unsave css if url is user's function (vitalets)         
-          
-                 
+		  
+				 
 Version 1.0.0 Nov 19, 2012 
 ----------------------------
 Initial release. This library is new life of bootstrap-editable (1.1.4) that was strongly refactored and improved.
@@ -89,7 +90,7 @@ Main features:
 - different container classes to show form: popover, tooltip, poshytip, etc
 - inline and popup versions 
 - new directory structure and logic in separate js files allowing easy contribution
-                                                                
+																
 It is not fully compatible with bootstrap-editable but has mainly the same interface and api.
 Here list of differences to help you to upgrade your application:
 
diff --git a/src/inputs/list.js b/src/inputs/list.js
index 6f2bcb1..b4c6197 100644
--- a/src/inputs/list.js
+++ b/src/inputs/list.js
@@ -139,10 +139,12 @@ List - abstract class for inputs that have source option loaded from js array or
                     }, this)
                 });
             } else { //options as json/array/function
-				if (typeof this.options.source === 'function')
-            		this.sourceData = this.makeArray(this.options.source());
-				else
-					this.sourceData = this.makeArray(this.options.source);
+                if (typeof this.options.source === 'function') {
+                   this.sourceData = this.makeArray(this.options.source());
+                } else {
+                   this.sourceData = this.makeArray(this.options.source);
+                }
+                    
                 if($.isArray(this.sourceData)) {
                     this.doPrepend();
                     success.call(this);   
@@ -163,10 +165,11 @@ List - abstract class for inputs that have source option loaded from js array or
                 if (typeof this.options.prepend === 'string') {
                     this.options.prepend = {'': this.options.prepend};
                 }              
-                if (typeof this.options.prepend === 'function')
-                	this.prependData = this.makeArray(this.options.prepend());
-				else
-					this.prependData = this.makeArray(this.options.prepend);
+                if (typeof this.options.prepend === 'function') {
+                    this.prependData = this.makeArray(this.options.prepend());
+                } else {
+                    this.prependData = this.makeArray(this.options.prepend);
+                }
             }
 
             if($.isArray(this.prependData) && $.isArray(this.sourceData)) {
diff --git a/test/unit/select.js b/test/unit/select.js
index cb2ea0b..15c5eb7 100644
--- a/test/unit/select.js
+++ b/test/unit/select.js
@@ -38,7 +38,7 @@ $(function () {
             e.remove();    
             start();  
         }, timeout);                     
-    })      
+    });      
     
      test("load options from json", function () {
          var e = $('<a href="#" data-type="select" data-value="2" data-url="post.php">customer</a>').appendTo('#qunit-fixture').editable({
@@ -92,7 +92,26 @@ $(function () {
         equal(p.find('select').val(), 'x', 'selected value correct') 
         p.find('button[type=button]').click(); 
         ok(!p.is(':visible'), 'popover was removed');  
-    }) 
+    }); 
+    
+     test("load options from function", function () {
+         var e = $('<a href="#" data-type="select" data-value="2" data-url="post.php">customer</a>').appendTo('#qunit-fixture').editable({
+             pk: 1,
+             prepend: 'prepend',
+             source: function() {
+                return groups; 
+             }
+          });
+
+        e.click()
+        var p = tip(e);
+        ok(p.is(':visible'), 'popover visible');
+        ok(p.find('select').length, 'select exists');
+        equal(p.find('select').find('option').length, size+1, 'options loaded');
+        equal(p.find('select').val(), e.data('editable').value, 'selected value correct') ;
+        p.find('button[type=button]').click(); 
+        ok(!p.is(':visible'), 'popover was removed');  
+    });    
     
      test("load options from html (single quotes)", function () {
          var e = $('<a href="#" data-type="select" data-value="M" data-source=\'{"L":"Low", "": "None", "M": "Medium", "H": "High"}\'>customer</a>').appendTo('#qunit-fixture').editable({