appgini ver: 5.60
I am trying to hide some form elements based on a selection via a lookup dropdown. Below is what I have tried and it does not work.
table-dv.js file content:
jQuery( document ).ready(function( $ ) {
console.log("Help Me"); // this works...
$("#fk_project").on("change", function() {
console.log("test"); // this does not.
$('#nn_other').hide();
});
});
lookup dropdown change event in table-dv.js
Re: lookup dropdown change event in table-dv.js
For those of you looking to solve the problem that I had here is the answer for the table-dv.js magic file.
This will only turn them off you will have to write some code to turn them back on if a different selection is made.
This will only turn them off you will have to write some code to turn them back on if a different selection is made.
Code: Select all
jQuery( document ).ready(function( $ ) {
jQuery('#fk_project-container').change(function(){
var cnt=document.getElementById('fk_project').value;//dropdown selected/changed value
if(cnt==1){
//as you can see from the code below you can hide parent elements as well which would hide multiple controls at once
$('#nn_training0').parent().parent().parent().hide();
$('#nn_warfare').parent().parent().hide();
$('label[for="nn_other"]').hide();
$('#nn_other').hide();
$('#nn_tools').parent().parent().hide();
}else if (cnt==2) {
//and hide other controls if a different selection is made.
$('label[for="d_div"]').hide();
$('#d_div').parent().hide();
$('label[for="d_role"]').hide();
$('#d_role').parent().hide();
$('#d_training').parent().parent().hide();
$('#d_inc').parent().parent().hide();
$('#d_used').parent().parent().hide();
}
});
});