Custom Code

(Hash Variables are allowed in all the PHP tabs of this screen: see Appendix for Hash Variables)

Before Browse

This PHP code is executed when a Search Screen is loaded.
As an example you can create a temporary table for the Search Screen to query.
e.g. replace the SQL under the General Tab with the following:
SELECT * FROM #browseTable#

Then you could use the following style of PHP code.
nuRunQuery(“CREATE TABLE #browseTable# SELECT * FROM …etc… “);


The Print Button ( Forms: Action Buttons ) uses a cached version of Before Browse (cached the last time Search was clicked).
the cached version has all carriage returns removed so php code like this..

\\-- written by bob
$s = "CREATE TABLE #browseTable# SELECT * FROM customer WHERE customer_id = 'xxxx'";

will be treated like this..

\\-- written by bob$s = "CREATE TABLE #browseTable# SELECT * FROM customer WHERE customer_id = 'xxxx'";nuRunQuery($s);

And nothing will be run.

After Browse

This PHP code is executed when a record has been selected.
Populating an array called ‘$updateField’ will allow values to be filled in on the current Edit Screen.
Eg. Creating an array element of : $updateField[‘cus_address’] = ‘Not applicable’; will put ‘Not applicable’ into the field called cus_address.

Before Open

This PHP code is executed when a new record is created or an existing record is selected. You can use PHP here to create Javascript function definitions using hash variables that aren't normally available in Javascript. For example;

$javascript = "function getUserGroup() { return '".'#access_level#'."';} ";
$javascript .= "function getSession() { return '".'#session_id#'."';} ";

You can also use it to load values into fields, and you can query other tables not available to that form.

Before Save

This PHP code is executed when a save button is pressed but before the save is executed. This is where you perform data validation to ensure the consistency and validity of your data before the save is executed.

After Delete

This PHP code is executed once the user clicks the delete button and then clicks on the confirmation button. Often used when a record is deleted to modify or delete other records to maintain the consistency and integrity of the data in your database.

After Save

This PHP code executes when a user clicks the save button after the before save code runs. You can use this field to modify other tables in your database, like updating product stock levels when a transaction is saved.


This code field is for Javascript function definitions that you want to use anywhere in the rest of the form. You can use document.getElementById('field_name').value to retrieve or update the value in an object.

Created by: system. Last Modification: Tuesday 06 of November, 2012 13:36:14 CST by steven.