diff --git a/main/inc/lib/formvalidator/Element/SelectAjax.php b/main/inc/lib/formvalidator/Element/SelectAjax.php index efa1f67aea..41d63a7f98 100644 --- a/main/inc/lib/formvalidator/Element/SelectAjax.php +++ b/main/inc/lib/formvalidator/Element/SelectAjax.php @@ -66,6 +66,14 @@ class SelectAjax extends HTML_QuickForm_select $this->setAttribute('id', $id); } + $url = $this->getAttribute('url'); + + if (!$url) { + $url = $this->getAttribute('url_function'); + } else { + $url = "'$url'"; + } + $html .= << $(function(){ @@ -76,7 +84,7 @@ class SelectAjax extends HTML_QuickForm_select width: '$width', minimumInputLength: '$minimumInputLength', ajax: { - url: '{$this->getAttribute('url')}', + url: $url, dataType: 'json', data: function(params) { return { @@ -102,6 +110,7 @@ JS; $this->removeAttribute('placeholder'); $this->removeAttribute('class'); $this->removeAttribute('url'); + $this->removeAttribute('url_function'); $this->setAttribute('style', 'width: 100%;'); return parent::toHtml() . $html;