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



}


Hi Abhinay,


Any suggestions from ur end which can fix this up


Can you post the entire html here


Are you sure the choice value is 102?