Back
jsEvents
Programming
jsEvents
Allows you to add onchange and onclick handlers to phpLens objects that already use Javascript, eg when editing records
Default:
The example below creates javascript handlers for the fields ProductID and UnitPrice. For UnitPrice, we have 2 event handlers, and onchange handler which displays an alert, and a onkeypress handler that calls the function PRESS. It works in a similar fashion for ProductID.

The HTML will work as follows:

<input type=text name=lens_FC_UNITPRICE id=lens_FC_UNITPRICE
    onchange='alert(this.name)' onkeypress='PRESS(this)'>

<input type=text name=lens_FC_PRODUCTID id=lens_FC_PRODUCTID
    onclick='oncHANGE(this)' onchange='IGNORE(this)'>

To invoke a javascript handler on the onsubmit event, call a Custom Javascript Function in the validation property.

Also see powerJavascript for more javascript functionality.

Syntax
$lens->jsEvents = 'unitPrice^onchange^alert(this.name)^onkeyPRESS^PRESS'.
';PRODUCTId^onclick^clicker^oncHANGE^changer^IGNORE';

 Basic:Yes  Advanced/Enterprise:Yes  DynamicEdit:Yes   [Version 5.0]