2018-05-18 06:28:27 +00:00
|
|
|
/**
|
|
|
|
* @package Joomla.Component.Builder
|
|
|
|
*
|
|
|
|
* @created 30th April, 2015
|
|
|
|
* @author Llewellyn van der Merwe <http://www.joomlacomponentbuilder.com>
|
|
|
|
* @github Joomla Component Builder <https://github.com/vdm-io/Joomla-Component-Builder>
|
2020-12-25 21:16:34 +00:00
|
|
|
* @copyright Copyright (C) 2015 - 2021 Vast Development Method. All rights reserved.
|
2018-05-18 06:28:27 +00:00
|
|
|
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
|
|
|
*/
|
2016-01-30 20:28:43 +00:00
|
|
|
|
2017-10-12 23:14:17 +00:00
|
|
|
|
|
|
|
|
2018-03-11 02:44:43 +00:00
|
|
|
|
2017-10-12 23:14:17 +00:00
|
|
|
function getFieldSelectOptions_server(fieldId){
|
2019-07-08 16:05:54 +00:00
|
|
|
var getUrl = JRouter("index.php?option=com_componentbuilder&task=ajax.fieldSelectOptions&format=json");
|
2017-10-12 23:14:17 +00:00
|
|
|
if(token.length > 0 && fieldId > 0){
|
2019-07-08 16:05:54 +00:00
|
|
|
var request = token+'=1&id='+fieldId;
|
2017-10-12 23:14:17 +00:00
|
|
|
}
|
|
|
|
return jQuery.ajax({
|
|
|
|
type: 'GET',
|
|
|
|
url: getUrl,
|
|
|
|
dataType: 'jsonp',
|
|
|
|
data: request,
|
|
|
|
jsonp: 'callback'
|
|
|
|
});
|
|
|
|
}
|
2017-11-26 00:29:08 +00:00
|
|
|
function getFieldSelectOptions(fieldKey){
|
2017-10-12 23:14:17 +00:00
|
|
|
// first check if the field is set
|
2017-11-26 00:29:08 +00:00
|
|
|
if(jQuery("#jform_addconditions__addconditions"+fieldKey+"__match_field").length) {
|
|
|
|
var fieldId = jQuery("#jform_addconditions__addconditions"+fieldKey+"__match_field option:selected").val();
|
2017-10-12 23:14:17 +00:00
|
|
|
getFieldSelectOptions_server(fieldId).done(function(result) {
|
|
|
|
if(result){
|
2017-11-26 00:29:08 +00:00
|
|
|
jQuery('textarea#jform_addconditions__addconditions'+fieldKey+'__match_options').val(result);
|
2017-10-12 23:14:17 +00:00
|
|
|
}
|
|
|
|
else
|
2016-01-30 20:28:43 +00:00
|
|
|
{
|
2017-11-26 00:29:08 +00:00
|
|
|
jQuery('textarea#jform_addconditions__addconditions'+fieldKey+'__match_options').val('');
|
2016-01-30 20:28:43 +00:00
|
|
|
}
|
2017-10-12 23:14:17 +00:00
|
|
|
});
|
2016-01-30 20:28:43 +00:00
|
|
|
}
|
|
|
|
}
|
2017-10-12 23:14:17 +00:00
|
|
|
|
|
|
|
|