UI Page reference field displayValue

klautrup
Kilo Expert

Hi,
My my limited coding skills I managed to get a UI Action to pass the DisplayValue from a sys_user reference field on a table form to a UI Page using:


var UserValue = g_form.getDisplayBox('u_business_owner').value;

 

Using it in the UI Page like this:

<g:evaluate>
var UserValue = RP.getWindowProperties().get('uUserValue');
</g:evaluate>

<g:ui_reference name="user_name" table="sys_user" displayValue="${UserValue}"/>

That correctly copies the user from the table form with the UI Action:
find_real_file.png

However, if on the UI Page I then want to update with another user by clicking the magnifying glass icon it limits the filter only to the copied user:

find_real_file.png

How do I get the UI Page to display all the records in sys_user like if I do the same on the table form:
find_real_file.png

Which despite the set user "AVESA" shows all users in sys_user?

 

1 ACCEPTED SOLUTION

Dennis R
Tera Guru

When you set just the display value, it's like typing a name into a form field without validating it. You can validate this by typing AVESA into the form field without selecting the user name from the dropdown and hitting the magnifying glass, it will only show you AVESA.

 

But more to the point, to get it to work the way you want, just also give the field a value in addition to a display value. Try this:

 

var UserDisplayValue = g_form.getDisplayBox('u_business_owner').value;
var UserValue = g_form.getValue('u_business_owner');

 

And then this on your UI Page:

 

<g:evaluate>
  var UserDisplayValue = RP.getWindowProperties().get('UserDisplayValue');
  var UserValue = RP.getWindowProperties().get('UserValue');
</g:evaluate>

<g:ui_reference name="user_name" table="sys_user" displayValue="${UserDisplayValue}" value="${UserValue}"/>

 

Using this, your field will actually be a resolved value, and the magnifying glass will display all users available.

 

Hope this helps,

--Dennis R

View solution in original post

1 REPLY 1

Dennis R
Tera Guru

When you set just the display value, it's like typing a name into a form field without validating it. You can validate this by typing AVESA into the form field without selecting the user name from the dropdown and hitting the magnifying glass, it will only show you AVESA.

 

But more to the point, to get it to work the way you want, just also give the field a value in addition to a display value. Try this:

 

var UserDisplayValue = g_form.getDisplayBox('u_business_owner').value;
var UserValue = g_form.getValue('u_business_owner');

 

And then this on your UI Page:

 

<g:evaluate>
  var UserDisplayValue = RP.getWindowProperties().get('UserDisplayValue');
  var UserValue = RP.getWindowProperties().get('UserValue');
</g:evaluate>

<g:ui_reference name="user_name" table="sys_user" displayValue="${UserDisplayValue}" value="${UserValue}"/>

 

Using this, your field will actually be a resolved value, and the magnifying glass will display all users available.

 

Hope this helps,

--Dennis R