Skip to content

Commit db47dcf

Browse files
committed
Fixed url concat in SiteTreURLSegmentField.js
Needed to handle existing GET params, e.g. added from the translatable module
1 parent ef651d9 commit db47dcf

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

javascript/SiteTreeURLSegmentField.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -127,13 +127,13 @@
127127
* (Function) callback
128128
*/
129129
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+
131134
$.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);}
137137
);
138138

139139
},

0 commit comments

Comments
 (0)