NetSuite uses the ExtJS library for a variety of purposes including showing popup windows for alerts and confirmations. We can make use of this to tailor this popup window for our own uses cases which would otherwise couldn’t be met using the standard ‘N/ui/dialog Module’
Note : We are using the ExtJS library which NetSuite used for building their own popup/modal/dialog purpose. If NetSuite decides to upgrade this library or change this to another library, it may break the existing scripts if we use the ExtJS library directly.
Show a popup window in NetSuite with a Radio button
The following code snippet is for the scenario defined below :
The popup window should have a title and a message. The popup should have an option like a radio button. Upon submission, we should retrieve which radio button option is selected by the user.
To create a popup window in NetSuite using the ExtJS library with a title, message, and a radio button field, you can use the following code:
// Create a function to show the popup window
function showPopupWindow() {
// Create a radio button field
var radioButtonField = new Ext.form.RadioGroup({
fieldLabel: 'Choose an option',
columns: 1,
items: [
{ boxLabel: 'Option 1', name: 'radioOption', inputValue: 'option1' },
{ boxLabel: 'Option 2', name: 'radioOption', inputValue: 'option2' },
{ boxLabel: 'Option 3', name: 'radioOption', inputValue: 'option3' }
]
});
// Create the submit button
var submitButton = new Ext.Button({
text: 'Submit',
handler: function() {
// Retrieve the selected radio button value
var selectedValue = radioButtonField.getValue().inputValue;
// Perform any desired actions with the selected value
console.log(' radioButtonField.getValue()', radioButtonField.getValue());
console.log('Selected value:', selectedValue);
// Close the popup window
popupWindow.close();
}
});
// Create the popup window
var popupWindow = new Ext.Window({
title: 'Select an option',
layout: 'form',
items: [radioButtonField],
buttons: [submitButton]
});
// Show the popup window
popupWindow.show();
}
// Call the function to show the popup window
showPopupWindow();

This code will create a popup window with a title, a radio button field labeled “Choose an option,” and a submit button. The radio button field allows the user to select one of the provided options. Upon clicking the submit button, the selected value will be retrieved, and you can perform any desired actions with this value.