Connecting Tech Pros Worldwide Forums | Help | Site Map

Using onValidate in CFGRID

Haitashi's Avatar
Member
 
Join Date: Jun 2007
Location: Orlando, FL
Posts: 94
#1: Feb 13 '08
I have the following grid:
Expand|Select|Wrap|Line Numbers
  1.     <cfgrid name="gridChartType"
  2.         delete="true"
  3.         deletebutton="Remove"
  4.         insert="true"
  5.         insertbutton="Add"
  6.         width="714"
  7.         height="500"
  8.         format="flash"
  9.         query="variables.qChartType"
  10.         onValidate="checkValues"
  11.         selectmode="edit">
  12.             <cfgridcolumn name="id" display="false" />
  13.             <cfgridcolumn header="Name" width="500" name="chart" />
  14.             <cfgridcolumn header="Code" width="214" name="code" />
  15.     </cfgrid>
The function called "checkValues" is a function that exist in a JS file. This file is inclided at the beggining of the file but outside the form.

However, it doesn't seem to be working. When I add/edit/delete anything in the cgrid, that function doesn't execute. What I need to validate is that the cfgridcolumn called code doesn't exceed 3 characters.

So, my questions are:
  1. Am I calling the JS function the right way?
  2. Is the way I'm including the JS file correct?
  3. Does anyone have a link to a working example/tutorial of cfgrip that includes validation "how to"?

Maybe my function isn't written correctly in the JS file (but that would be a Javascript issue and not a CF issue)

Thanks in advance!!

Haitashi's Avatar
Member
 
Join Date: Jun 2007
Location: Orlando, FL
Posts: 94
#2: Feb 13 '08

re: Using onValidate in CFGRID


My problem was that I was using the flash cfgrid format and onValidate only works with the applet format.

Now I gotta figure out if it's possible to validate data while using the flash format =P
acoder's Avatar
Site Moderator
 
Join Date: Nov 2006
Location: UK
Posts: 14,581
#3: Feb 14 '08

re: Using onValidate in CFGRID


Firstly, check that the JS is correct by changing it to applet. If it works, then you may need to look at an ActionScript solution.
Reply


Similar ColdFusion bytes