Find your people. Pick a challenge. Ship something real. The CreatorCon Hackathon is coming to the Community Pavilion for one epic night. Every skill level, every role welcome. Join us on May 5th and learn more here.

ui_reference : How to use the record

Jean-Fran_ois A
Tera Expert

Hi,

I'm working on a UI page that has the following sections:

HTML
<g:ui_reference name="QUERY:release=${jvar_release_gr}^status!=rejected^channel.testchannel=false^channel.channeltype=TV standard" id="assigned_to" table="x_inpt3_channel" onchange="doMyOnChange()" />

//The input field value is based on attribute of the record chosen above in the ui_reference
<g:ui_input_field label="channelID" name="channelID" value="?????" size="50" readonly="true"/>

Client script

function doMyOnChange() {

//Use the record chosen in the ui_reference

}

I have the following questions:

  1. How can I use one of the attributes of the record chosen in the ui_reference as the value for the ui_input_field?
  2. How can I pass the record chosen in the ui_reference to the doMyOnChange() function in the client script?
  3. In ui_reference, is it possible to replace the parameter "name=QUERY:" by the "query" parameter? If yes, how do we handle all the special characters?

Thank you

 

 

1 ACCEPTED SOLUTION

DrewW
Mega Sage

If you have

<g:ui_reference name="selected_incident" id="selected_incident" table="sn_si_incident"  onchange="enablePreview()"/>

You should be able to use can use

//Client side
var sec_inc_sid = gel('selected_incident').value;
//or
document.getElementById('selected_incident')

//Processing script
var x = request.getParameter("selected_incident")

The existing UI Pages have lots of examples.

 

View solution in original post

4 REPLIES 4

DrewW
Mega Sage

If you have

<g:ui_reference name="selected_incident" id="selected_incident" table="sn_si_incident"  onchange="enablePreview()"/>

You should be able to use can use

//Client side
var sec_inc_sid = gel('selected_incident').value;
//or
document.getElementById('selected_incident')

//Processing script
var x = request.getParameter("selected_incident")

The existing UI Pages have lots of examples.

 

In my example, it does not work because the "name" element is actually the QUERY.

Then change it so it has a proper name and id attribute and use the query attribute for the actual query you want to use.

You can look at the "add_to_app_dialog" UI Page to see how they did a dynamic query.

There are lots of UI Pages that you can use as examples.

Hi @DrewW 

 

I am getting same issue my lookup not working while adding multiple condition by sapreting the AND in query 

<g:ui_reference name="oldCiReference" id="oldCiReference" query="status==5^location==location " table="u_cmdb_toc_devices" onChange="getCiValuesOld()" />
</td>

 

If i remove the AND condition location ==location then the lookup working fine could you suggest