Display a popup window in NetSuite with a Radio Field

Here we use ‘ExtJs’ to show the popup, and this is the one used by NetSuite to display the popup window. So, we can directly utilize this ‘Ext’ library in the scripts. Use the following code to display the popup window to input the Radio field value.

function showPopupWindow() {
  var selectField = Ext.create('Ext.form.Panel', {
    
   xtype      : 'fieldcontainer',
   fieldLabel : 'Radio field',
   defaultType: 'radiofield',
   width: 400,
   defaults: {
      flex: 1
   },
   layout: 'hbox',
   items: [{
      boxLabel  : 'A',
      inputValue: 'a',
      id        : 'radio1'
   },{
      boxLabel  : 'B',
      inputValue: 'b',
      id        : 'radio2'
   },{
      boxLabel  : 'C',
      inputValue: 'c',
      id 	      : 'radio3'
   }]
});

  // Create the save button
  var submitButton = new Ext.Button({
    text: 'Save',
    handler: function() {
      var form = this.up('form').getForm();
      if (form.isValid()) {
        var values = form.getValues();
        // Process and save the form data
      }
    }
  });

  // Create the popup window
  var popupWindow = new Ext.Window({
    title: 'Choose an Option',
    layout: 'form',
    items: [selectField],
    buttons: [submitButton]
  });

  // Show the popup window
  popupWindow.show();
}

// Call the function to show the popup window
showPopupWindow();

Leave a comment

Your email address will not be published. Required fields are marked *