Friday, April 15, 2011

Getting the Display value of a variable reference field

Getting the Display value of a variable reference field

On occasion there is need to get the display value of reference variable.
There are two ways to accomplish this first is make the call back to the server and query the table.

The second and more efficient way is to use get display box function of g_form.


var refFieldDispVal = g_form.getDisplayBox('the reference field').value;


Thanks to Mark Stanger for this pointer.

2 comments:

Unknown said...

Thanks for this Mark! Hav'nt seen or heard of the getDisplayBox function before.

Indeed, using a callback just to get a displayvalue already visible on the form doesnt sound like a great idea! :) Scratchpad seems overkill for a value already displayed as well.

getAttribute from a specified Element is'nt very pretty.

Why on earth is there no getDisplayValue() on g_form!?

Kind regards,
Dan Berglin

Dan said...

Works as advertised. Thanks!

SN should provide the ability to read the value on a form without having to check back with the server.