how to get a popup window with a field to be entered?

swathigangadhar
Tera Expert

how to get a popup window, where i can enter some text. onchange of some field?

1 ACCEPTED SOLUTION

Please tell me where you are facing the issue, first you need to create a onChange client script with below code. Then make a UI page with name 'add_comments_dialog' and then add the code given in the link in HTML (section 4.2.1) and client script code   (section 4.2.2) in the Client script part of UI page.



http://wiki.servicenow.com/index.php?title=Displaying_a_Custom_Dialog#gsc.tab=0



Mark Correct if it solved your issue or hit Like and Helpful if you find my response worthy.



onChange client script



function onChange(control, oldValue, newValue, isLoading, isTemplate) {
    if (isLoading || newValue === '') {
          return;
    }
commentsDialog();


function commentsDialog() {
    //Get the values to pass into the dialog
    var comments_text = g_form.getValue("comments");
    var short_text = g_form.getValue("short_description");

    //Initialize and open the dialog
    var dialog = new GlideDialogWindow("add_comments_dialog"); //Instantiate the dialog containing the UI Page 'add_comments_dialog'
    dialog.setTitle("Add Task Comments"); //Set the dialog title
    dialog.setPreference("comments_text", comments_text); //Pass the comments into the dialog
    dialog.setPreference("short_text", short_text); //Pass in a short description for use in the dialog
    dialog.render(); //Open the dialog
}
   
}



find_real_file.png


View solution in original post

5 REPLIES 5

Hi Deepa! Thanks for your support. 

 

Could you copy and paste here the HTML code and the ClientScript code? Because I cant access to the page that you shared.