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

am not able to do this, can you please help me with this? On change of category a pop-up need to be opened with a text field.



can you please help me?


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


Hi Deepa,



I have created the GlideDialogwindow on my customer registration page and followed the same but my UI page is not rendering for the users who are not in the system. I have given the read access to public on the UI page table, but the UI page stays on loading in Glide Window so could you please help me on this.