Check documentation for the latest version 6.0 of dhtmlxSuite beforeUpdate DHTMLX Docs

beforeUpdate

The event occurs before updating values in database and can cancel default update statement or validate incoming values.

<cfset grid.event.attach("beforeUpdate",handlerFunc)>

Parameters handlerFunc:

  • action - DataAction Object

Availability:

  • Available for Grid, TreeGrid, Tree, Scheduler, DataView, Form

Sample:

<!--- creates and runs own update statement using values came in request, cancels default update --->
<cffunction name="myUpdate">
    <cfargument name="action">
        <cfquery datasource="#request.datasource#" name="upd">
         UPDATE Countries SET item_nm='#ARGUMENTS.action.get_value('item_nm')#' WHERE item_id='#ARGUMENTS.action.get_id()#'
        </cfquery>
        <cfset ARGUMENTS.action.success()>
</cffunction>
<!--- checks if value of name is empty, then cancel update. Otherwise proceeds with default update --->  
<cffunction name="myUpdate">
    <cfargument name="action">
        <cfif ARGUMENTS.action.get_value("name") eq "")>
        <cfset ARGUMENTS.action.invalid()>
    </cfif>
</cffunction>
<!--- sets new value for name and proceeds with default update ---> 
<cffunction name="myUpdate">
    <cfargument name="action">
    <cfset var new_value=RandRange(0,100)>
        <cfset ARGUMENTS.action.set_value("name",new_value)>
</cffunction>
Back to top