can i disable a button in a client script
# ask-stanley-ai
b
can i disable a button in a client script
c
AI generated answer (using internal Slack threads):
Based on the conversations, it appears that you cannot directly disable a button in a client script using SuiteScript. The serverWidget module, which could potentially be used for this purpose, is not available on the client side. However, you can use regular JavaScript to manipulate the DOM and achieve similar results. For example, you can hide a button by changing its display style to 'none'. Here is a code snippet that was shared:
Copy code
javascript
const feeButton = document.getElementById('buttonId').style.display = 'none';
Another approach discussed is to disable the button as the first action in the client script to prevent double-clicking. Here is a code snippet that was shared:
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;
}
Please note that these methods involve manipulating the DOM directly, which is not technically supported by NetSuite and may lead to unexpected behavior. ****** Disclaimer: This response was generated by an artificial intelligence assistant based on previous conversations from multiple Slack channels, and may contain inaccuracies or mistakes. ******
Slack thread 1: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.854407907
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.848362148
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.837868512
Please provide your feedback on this answer.