The CreatorCon Call for Content is officially open! Get started here.

GlideDialog box

surya123
Mega Guru

Hi All

I have a glide dialog box for which i wrote   a ui action and a ui page . What i see is when a user enters something in Description field and without saving the form , clicks on button which will render glide dialog box, then it gives a message as "chnages you have entered will not be saved". How can i make the desc get saved even when the user is not saving but directly clicking on ui action button.

There is some description which also gets added to the descrption field which is based on the data that got created based on UI action. How to concatenate the 1st desc which was entered by user and the second one in case of glide dialog?

1 ACCEPTED SOLUTION

Abhinay Erra
Giga Sage

well that is weird.   It works fine for me. Did you make sure the choice is active and try to clear cache and see if that helps.


View solution in original post

19 REPLIES 19

Abhinay Erra
Giga Sage

What type of UI action is it? List choice button?


Form button


So are you trying to set the description field on this form from GlideDialogWindow? Can you elaborate?


In the change Task, there is a description field. Som one entering in descrition and without saving clicks on the Ui action that opens a dialog box. Then i would like whatever is saved in the desc should also get saved on form. whatever i enter in form, is also saved in the desc field.


So if a user enters ABC in desc and clicks on Ui action and enters DEF in field of dialog.


Thn ABC and DEF should get saved in desc.


surya123



You do not need to save the record to get the value of the description the user entered before clicking the button. When you say g_form.getValue('description'); it gets the value on the form. Here is the sample UI Action code, and Ui page code. See the highlighted portion in the UI page client script.



UI Action:


function popupDispList() {


  //Initialize the GlideDialogWindow


  //g_form.save();


  var gdw = new GlideDialogWindow('display_incident_list');


  gdw.setTitle('Incidents');


  //gdw.setPreference('table', 'incident_list');


  //gdw.setPreference('sysparm_view', 'default');



  //Set the table to display




  //Open the dialog window


  gdw.render();


}



UI page:


HTML:


<?xml version="1.0" encoding="utf-8" ?>


<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">


<g:ui_form>


  <!-- Get the values from dialog preferences -->


    <g:evaluate var="jvar_comments_text"


      expression="RP.getWindowProperties().get('comments_text')" />


    <!-- Set up form fields and labels -->


    <table width="100%">


        <tr id="description_row" valign="top">


              <td colspan="2">


                    <!-- Short description value used as a label -->


                    ${jvar_short_text}


              </td>


        </tr>


        <tr>


            <td>


                <!-- Comments text field (Contains comments from originating record as a default) -->


           


                    <g:ui_input_field name="dialog_comments" id="dialog_comments" label="Display Name"


                      />


             


            </td>


        </tr>


        <tr>


            <td colspan="2">


            </td>


        </tr>


        <tr id="dialog_buttons">


              <td colspan="2" align="right">


                    <!-- Add OK/Cancel buttons. Clicking OK calls the validateComments script -->


                    <g:dialog_buttons_ok_cancel ok="return validateComments()" ok_type="button" cancel_type="button" />


              </td>


        </tr>


  </table>


</g:ui_form>


</j:jelly>



Client script:


function validateComments() {


  var text=g_form.getValue('short_description')+' '+$('dialog_comments').value;


  g_form.setValue('short_description',text);


  g_form.save();


  //This script is called when the user clicks "OK" in the dialog window



  //Make sure there are comments to submit


  var ga = new GlideAjax('TestInsert');


  ga.addParam('sysparm_name','insertRec');


  ga.addParam('sysparm_desc',$('dialog_comments').value);


  ga.getXML(HelloWorldParse);



  function HelloWorldParse(response) {


  var answer = response.responseXML.documentElement.getAttribute("answer");


  if(answer)


  alert(answer +" record inserted");


  }



  //If there are comments, close the dialog window and submit them


  GlideDialogWindow.get().destroy(); //Close the dialog window



}