2021-03-05 03:08:47 +00:00
|
|
|
/**
|
|
|
|
* @package Joomla.Component.Builder
|
|
|
|
*
|
|
|
|
* @created 30th April, 2015
|
2022-07-09 15:45:08 +00:00
|
|
|
* @author Llewellyn van der Merwe <https://dev.vdm.io>
|
|
|
|
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
|
2021-03-05 03:08:47 +00:00
|
|
|
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
|
|
|
|
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
|
|
|
*/
|
|
|
|
|
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
|
|
|
|
2021-03-05 03:08:47 +00:00
|
|
|
|