ontarget
Active Member
Hi I have a bunch of validations running through form_1.js
Since upgrading to joomla 3.9.x and Fabrik 3.9 i seem to be having issues with js validations even basic onchange show / hide stuff
I'm thinking that my js file is rather messy with form elements being repeated in various functions - I would like to tidy up my work and make all the repeated variables used locally global instead - I think i then have a better chance of fixing my validation issues.
Is this the correct method?
My old javascript was
Since upgrading to joomla 3.9.x and Fabrik 3.9 i seem to be having issues with js validations even basic onchange show / hide stuff
I'm thinking that my js file is rather messy with form elements being repeated in various functions - I would like to tidy up my work and make all the repeated variables used locally global instead - I think i then have a better chance of fixing my validation issues.
Is this the correct method?
JavaScript:
var modeTransport = Fabrik.getBlock('form_1').formElements.get('aaa_participant_claim___mode_of_transport');
var publicTransport = Fabrik.getBlock('form_1').formElements.get('aaa_participant_claim___public_transport');
var stationEircode = Fabrik.getBlock('form_1').formElements.get('aaa_participant_claim___station_eircode');
function showPublic(){
if (modeTransport.getValue() === 'car') {
publicTransport.hide();
stationEircode.hide();
}
}
My old javascript was
JavaScript:
function showPublic(el){
var elTransport2 = el.form.formElements.get('aaa_participant_claim___mode_of_transport');
var elPublic2 = el.form.formElements.get('aaa_participant_claim___public_transport');
var elEircodeStat = el.form.formElements.get('aaa_participant_claim___station_eircode');
if (elTransport2.getValue() === 'car') {
elPublic2.hide();
elEircodeStat.hide();
}
}