This topic is locked

Disable Field on add/edit page based on value from other table

7/27/2016 6:16:34 AM
PHPRunner Tips and Tricks
romaldus author

Example:
Field : id, payment_status, and so on.....................
[color="#0000ff"]curent add/edit table name is registration

Field: field1, field2, field3
i want if field3[/b] is disabled in add/edit page (registration table)
use the following code in registration table > add/edit> before display event:



$sql = "SELECT payment_status AS payment_check FROM payment WHERE id = 'blablabla'";

$rs = CustomQuery($sql);

$data = db_fetch_array($rs);

$_SESSION["payment_checker"] = $data["payment_check"];

$pageObject->setProxyValue("paymentcheck", $_SESSION["payment_checker"]);

$pageObject->setProxyValue("values", $pageObject->getCurrentRecord());


In Javascrip onload of add/edit page:



if (proxy.paymentcheck='PAID')

{

var ctrl = Runner.getControl(pageid, 'field3');

ctrl.setDisabled();

}


Other Methods:

http://xlinesoft.com...p_variables.htm