logo

NJP

spModal Prompt for input with proper label (Not Just red asterisk)

Import · Apr 12, 2020 · article

In widget client script, if you are trying to take an input from the user using spModal.Prompt you must have ended with a dialog where there is input box but there is no label along with it but only *, that seems very odd.

you must have also tried below knowledge articles which are near to the solution; but that is not satisfactory.

1) How to use spModal.prompt; Shows no label, but * alone

https://docs.servicenow.com/bundle/kingston-application-development/page/app-store/dev_portal/API_re...

image

2) How to put label with prompt; Shows label but not where we exact want.

https://developer.servicenow.com/dev.do#!/reference/api/orlando/client/SPModal-API

image

3) Working Solution: The label comes as expected

image

We used the solution (2) but modified the JSON parameter for open method, used the "label" instead of "message", as below...


    spModal.open({
        title: 'Give me a name',
        label: 'Please type name here...',
        input: true,
        value: c.name
    }).then(function(name) {
        c.name = name;
    })

Regards

Chirag A

www.aavenir.com

View original source

https://www.servicenow.com/community/developer-articles/spmodal-prompt-for-input-with-proper-label-not-just-red-asterisk/ta-p/2322212