Page 1 of 1
Buton Save - Show or Hidden
Posted: Tue Jun 03, 2025 3:05 am
by cjuliao
Good evening. How do I make it so that when editing a form, the 'save' button is shown or hidden based on a field called 'approved' (Yes/No)? If it is 'Yes', hide the save button; if it is 'No', then show the save button. The above is to protect the data. I appreciate your help.
Re: Buton Save - Show or Hidden
Posted: Tue Jun 03, 2025 4:20 am
by kev1n
Hi,
In the form's Custom Code, add this JavaScript:
Code: Select all
// Function to toggle the visibility of the Save button based on 'approved' checkbox state
function toggleSaveButton() {
var isApproved = nuGetValue('approved'); // Retrieves true if checked, false otherwise
// If 'approved' is checked (true), hide the Save button; otherwise, show it
nuShow('nuSaveButton', isApproved); // Second parameter 'true' hides the element
}
// Execute the function when the form loads
toggleSaveButton();
// Also execute the function when the 'approved' checkbox state changes
$('#approved').change(function() {
toggleSaveButton();
});

If the "approved" field's ID differs from 'approved', adjust the code accordingly to match the actual ID.