28 lines
1.4 KiB
JavaScript
28 lines
1.4 KiB
JavaScript
$(document).ready(function() {
|
|
function toggleUPSClasses() {
|
|
var selectedOption = $('#Nutmode_select').val();
|
|
$('.masterups').toggle(selectedOption === 'netclient'); // Show/Hide masterups based on Net Client
|
|
$('.slaveups').toggle(selectedOption === 'netserver'); // Show/Hide slaveups based on Net Server
|
|
|
|
// Enable/Disable inputs based on the selected option
|
|
$('.masterups input').prop('disabled', selectedOption !== 'netclient');
|
|
$('.slaveups input').prop('disabled', selectedOption !== 'netserver');
|
|
}
|
|
|
|
function toggleGenerics() {
|
|
var upsModelValue = $('#UPS_Model_select').val().toLowerCase(); // Get the current value from UPS_Model
|
|
var isGenericUps = upsModelValue === 'genericups'; // Check if it's 'genericups'
|
|
|
|
// Show/Hide generics section and enable/disable inputs
|
|
$('.generics').toggle(isGenericUps);
|
|
$('.generics input').prop('disabled', !isGenericUps); // Enable/Disable inputs based on the value
|
|
}
|
|
|
|
// Event listener for the selections
|
|
$('#Nutmode_select').change(toggleUPSClasses);
|
|
$('#UPS_Model_select').change(toggleGenerics); // Listen for changes in the UPS_Model dropdown
|
|
|
|
// Set the initial state based on current selections
|
|
toggleGenerics();
|
|
toggleUPSClasses();
|
|
}); |