I want to increase the number of input boxes

bonsai
Mega Sage

I'm using an input box with "var test = prompt("test");".
Is it possible to increase the input form of this input box to three?
I know that I can solve it by outputting the input box many times, but I want to implement input from three fields in one input box.find_real_file.png

1 ACCEPTED SOLUTION

bist-van
Tera Expert

Hello,

If I understand it correctly, you would like to open a modal window with more fields. 
If that's the case, you could use the spModal API as Paul mentioned. There is an example, which you can use to embed a simple widget into the modal window.

//HTML template
<button ng-click="c.onWidget('widget-cool-clock')" class="btn btn-default">
    Cool Clock
  </button>
//Client script
function(spModal) {
  var c = this;
  c.onWidget = function(widgetId, widgetInput) {
        spModal.open({
            title: 'Displaying widget ' + widgetId,
            widget: widgetId, 
            widgetInput: widgetInput || {}
        }).then(function(){
            console.log('widget dismissed');
        })      
    }
}

Best Regards,

István

View solution in original post

4 REPLIES 4

The SN Nerd
Giga Sage
Giga Sage

There isn't an OOB API for this exact requirement.


If you are working in the classic interface, you would have to create your own UI page and use the GlideDialog API.
If you are working in Service Portal, you could achieve this using the spModal API.
If you are working in Agent Workspace, you could achieve this using the g_modal API.

Perhaps we can assist further if you can mention the UI you are running this code from.


ServiceNow Nerd
ServiceNow Developer MVP 2020-2022
ServiceNow Community MVP 2019-2022

Thank you for answering! I wanted to implement it in Service Portal. Specifically, I want to modify the "link button" widget and make it so that the input box outputs when the button is clicked.

bist-van
Tera Expert

Hello,

If I understand it correctly, you would like to open a modal window with more fields. 
If that's the case, you could use the spModal API as Paul mentioned. There is an example, which you can use to embed a simple widget into the modal window.

//HTML template
<button ng-click="c.onWidget('widget-cool-clock')" class="btn btn-default">
    Cool Clock
  </button>
//Client script
function(spModal) {
  var c = this;
  c.onWidget = function(widgetId, widgetInput) {
        spModal.open({
            title: 'Displaying widget ' + widgetId,
            widget: widgetId, 
            widgetInput: widgetInput || {}
        }).then(function(){
            console.log('widget dismissed');
        })      
    }
}

Best Regards,

István

I was able to implement it by creating a widget with multiple input boxes and configuring it!
thank you!