Sets the variable to the given value. Use the setProxyValue() method to pass PHP values to JavaScript: you assign value to a variable in PHP and then use it in JavaScript.
This method is available on all pages and needs to be added to BeforeDisplay event.
Syntax
setProxyValue($name, $value)
Arguments
$name
any variable name. Example: "master".
$value
the value assigned to the variable. $value may be a simple value (e.g., string, number) or an array.
Return value
No return value.
Example 1
Setting and using regular variables and arrays. This code goes to BeforeDisplay event.
$pageObject->setProxyValue("name", "some value");
$pageObject->setProxyValue("master",$pageObject->getMasterRecord());
Use the name and master variables in JavaScript OnLoad event:
alert(proxy['name']);
alert(proxy.master['Make']);
Example 2
Using PHP values in button's Javascript code.
BeforeDisplay event:
$pageObject->setProxyValue("name", "some value");
Javascript OnLoad event:
window.proxy = proxy;
Button's ClientBefore or ClientAfter event
alert(window.proxy['name']);
See also:
•RunnerPage class: getMasterRecord()
•Example: How to display any page in a popup window