Skip to content
This repository
Browse code

Fixed url concat in SiteTreURLSegmentField.js

Needed to handle existing GET params, e.g. added from
the translatable module
  • Loading branch information...
commit db47dcff4733e23d619cfa57d471063beee8ac84 1 parent ef651d9
Ingo Schommer authored June 29, 2012

Showing 1 changed file with 6 additions and 6 deletions. Show diff stats Hide diff stats

  1. 12  javascript/SiteTreeURLSegmentField.js
12  javascript/SiteTreeURLSegmentField.js
@@ -127,13 +127,13 @@
127 127
 			 *  (Function) callback
128 128
 			 */
129 129
 			suggest: function(val, callback) {
130  
-				var field = this.find(':text');
  130
+				var field = this.find(':text'), urlParts = $.path.parseUrl(this.closest('form').attr('action')),
  131
+					url = urlParts.hrefNoSearch + '/field/' + field.attr('name') + '/suggest/?value=' + encodeURIComponent(val);
  132
+				if(urlParts.search) url += '&' + urlParts.search.replace(/^\?/, '');
  133
+
131 134
 				$.get(
132  
-					this.closest('form').attr('action') + 
133  
-						'/field/' + field.attr('name') + '/suggest/?value=' + encodeURIComponent(val),
134  
-					function(data) {
135  
-						callback.apply(this, arguments);
136  
-					}
  135
+					url,
  136
+					function(data) {callback.apply(this, arguments);}
137 137
 				);
138 138
 				
139 139
 			},

0 notes on commit db47dcf

Please sign in to comment.
Something went wrong with that request. Please try again.