Welcome to the nuBuilder Forums!
Join our community by registering and logging in.
As a member, you'll get access to exclusive forums, resources, and content available only to registered users.
Join our community by registering and logging in.
As a member, you'll get access to exclusive forums, resources, and content available only to registered users.
Buton Save - Show or Hidden
Buton Save - Show or Hidden
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.
-
- nuBuilder Team
- Posts: 4581
- Joined: Sun Oct 14, 2018 6:43 pm
- Has thanked: 76 times
- Been thanked: 536 times
- Contact:
Re: Buton Save - Show or Hidden
Hi,
In the form's Custom Code, add this JavaScript:
If the "approved" field's ID differs from 'approved', adjust the code accordingly to match the actual ID.
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();
});

Re: Buton Save - Show or Hidden
Good evening.
Thank you very much. You gave me sufficient guidance to address my needs. I want to congratulate you on your excellent work.
Sincerely,
Carlos
Thank you very much. You gave me sufficient guidance to address my needs. I want to congratulate you on your excellent work.
Sincerely,
Carlos