Hello,
I have this following code placed in the text field element and it works flawlessly.
But when I copy the same code to the button element, it showed error in the console.
I suspect that it might have some requirement related to the button element.
I couldn't figure it out yet.
Error
I have this following code placed in the text field element and it works flawlessly.
But when I copy the same code to the button element, it showed error in the console.
I suspect that it might have some requirement related to the button element.
I couldn't figure it out yet.
JavaScript:
jQuery.ajax({
url: 'index.php?option=com_fabrik&format=raw&task=plugin.userAjax&method=getTName&tid=' + this.form.formElements.get('tk___ktid').getValue(),
method: 'get',
context: this
}).done(function (r) {
SplR = r.split(",");
AudioID ='DZ' + SplR[1] + SplR[2] + 'A';
VideoID ='DZ' + SplR[1] + SplR[2] + 'V';
this.form.formElements.get('tk___kAIDFier').update(AudioID);
this.form.formElements.get('tk___kVIDFier').update(VideoID);
/* Title and Name trimming spaces for file name */
var sTitle = this.form.formElements.get('tk___ktitle').getValue();
var MTitS = sTitle.replace(/ /g, '');
var MTitleS = MTitS.replace(" ", '');
var NameS = SplR[0].replace(/ /g, '');
var NameSF = NameS.replace(" ", '');
var MMyear = this.form.formElements.get('tk___kmyear').getValue();
var valS1 = NameSF + '_' + MMyear + '_' + MTitleS;
this.form.formElements.get('tk___kAfilename').update(valS1);
this.form.formElements.get('tk___kVfilename').update(valS1);
this.form.formElements.get('tk___kseqID').update(SplR[3]);
console.log(SplR[0], SplR[3], AudioID, VideoID);
document.querySelector('#tk___kiaAlink input:nth-child(2)').value = 'https://archive.org/download/' + AudioID + '/' + valS1 + '.mp3';
document.querySelector('#tk___kiaVlink input:nth-child(2)').value = 'https://archive.org/download/' + VideoID + '/' + valS1 + '.mp4';
});
Error
Code:
Uncaught TypeError: this.form.formElements is undefined
<anonymous> https://www.mysite.org/plugins/fabrik_element/button/button-min.js?bust=1603176649 line 3 > eval:1
addNewEventAux https://www.mysite.org/plugins/fabrik_element/button/button-min.js?bust=1603176649:3
jQuery 2
button-min.js:1:146
<anonymous> https://www.mysite.org/plugins/fabrik_element/button/button-min.js?bust=1603176649 line 3 > eval:1
addNewEventAux https://www.mysite.org/plugins/fabrik_element/button/button-min.js?bust=1603176649:3
jQuery 2