how to disable a button in client script
# ask-stanley-ai
t
how to disable a button in client script
c
AI generated answer (using internal Slack threads):
****** Disclaimer: This response was generated by an artificial intelligence assistant based on previous conversations from multiple Slack channels, and may contain inaccuracies or mistakes. ****** To disable a button in a client script in NetSuite, you can use JavaScript to manipulate the DOM. However, it's important to note that this method is not technically supported by NetSuite. Here's an example of how you can do it:
Copy code
javascript
function customButtonFunction() {
  var button = document.getElementById('custpage_custom_button');
  button.disabled = true; // Disable the button to prevent double-clicking

  // button action stuff
  // ...

  // once button stuff is done re-enable it
  button.disabled = false;
}
In this example, the button is disabled as the first action when the function is called, preventing the user from clicking it again while the function is running. Once the function has completed its tasks, the button is re-enabled. Another method is to hide the button after it's clicked. This can be done by changing the CSS display property of the button to 'none'. Here's an example:
Copy code
javascript
const feeButton = document.getElementById('buttonId').style.display = 'none';
In this example, the button disappears after it's clicked. This might be a bit odd from a user experience perspective, but it's a workaround to prevent the button from being clicked again. Remember, these methods are not officially supported by NetSuite and might not work in all cases.
Slack thread 1: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.845459044
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.843383849
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.83706665
Please provide your feedback on this answer.