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


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


<!--- 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()#'
        <cfset ARGUMENTS.action.success()>
<!--- 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()>
<!--- 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)>
Back to top