473,372 Members | 924 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,372 software developers and data experts.

CFGrid OnValidate Validation Applet Example

Does anyone have a sample validation applet they could share? I am using cfgrid (non-flash) and need to validate a date field and a float field. I can't find any non-flash examples and I need to get this working ASAP. Thanks in advance.
Feb 25 '08 #1
7 7076
acoder
16,027 Expert Mod 8TB
See this link from the docs. If you get stuck, post your code.
Feb 25 '08 #2
See this link from the docs. If you get stuck, post your code.
I'm using a very simple validation just to make sure I'm doing it correctly. When I display the value object in the js module, I get a complex value. Do I need to somehow parse that value in order to determine the row data? Also, when I display the field object, I only get [object]. Any lead you can give me will be greatly appreciated.

Coldfusion
Expand|Select|Wrap|Line Numbers
  1.  
  2. <cfgrid name="TRGrid" query="grid" width="725" height="300" onchange="showSave();"
  3. onvalidate="validateFields" 
  4. rowheaders="yes" colheaders="yes" colheaderalign="center" colheaderbold="yes"
  5. selectmode="edit" insert="yes" delete="yes" 
  6. insertbutton="Add New Task" deletebutton="Delete Selected Task" >
  7.     <cfgridcolumn name="CatDesc" header="Category" width="125" select="no">
  8.     <cfgridcolumn name="TaskID" header="Task" width="250" values="#TaskIDList#" valuesdisplay="#TaskDescList#">
  9.     <cfgridcolumn name="ActivityID" header="Activity" width="165" values="#ActIDList#" valuesdisplay="#ActDescList#">
  10.     <cfgridcolumn name="ActivityDate" header="Date" width="75" dataalign="right" mask="mm/dd/yy" type="string_nocase">
  11.     <cfgridcolumn name="Hours" header="Hours" width="65" dataalign="right" numberformat="00.00" type="numeric">
  12.     <cfgridcolumn name="ID" display="no" width="100">
  13.     <cfgridcolumn name="EmpID" display="no" header="Employee" width="100">
  14.     <cfgridcolumn name="CategoryID" display="no" header="Category" width="100">
  15. </cfgrid>
  16.  
javascript:
Expand|Select|Wrap|Line Numbers
  1. function validateFields(form, field, value) {
  2.     //Check for date field
  3.      if (field == "ActivityDate") {
  4.         if(value.length < 8) {
  5.             alert("A date value is incorrect. Please enter the date as mm/dd/yy.");
  6.             return false;
  7.         }
  8.         else {
  9.             return true;
  10.         }
  11.     }
  12.     //check for other fields here.
  13.     else {
  14.         return true;
  15.         }
  16. }
Feb 26 '08 #3
acoder
16,027 Expert Mod 8TB
Just to confirm, this cfgrid is within a cfform?
Feb 26 '08 #4
Just to confirm, this cfgrid is within a cfform?
Yes. The cfform contains a 2-column table: left side has some filtering links, right column displays the grid. I use a stored procedure to fill the grid and custom queries code to insert/delete/update the rows. Everything works great. Now I'm just trying to validate the date and hours columns.
Feb 27 '08 #5
acoder
16,027 Expert Mod 8TB
When I display the value object in the js module, I get a complex value. Do I need to somehow parse that value in order to determine the row data? Also, when I display the field object, I only get [object].
Do you mean an alert here? You could try checking the HTML/JavaScript source to see what's passed through.

PS. I don't program with onValidate much.
Feb 28 '08 #6
Do you mean an alert here? You could try checking the HTML/JavaScript source to see what's passed through.

PS. I don't program with onValidate much.
I just put an alert there for testing only. I did check the values being passed and the string is some type of concatenated list. I don't know if I'm suppose to parse it or use some special technique to determine the grid column and grid value being checked.
Feb 29 '08 #7
acoder
16,027 Expert Mod 8TB
Can you show an example of a list that is passed?
Feb 29 '08 #8

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Put 030516 in email subj to get thru | last post by:
I've always been bothered about having to statically declare the size of a Java applet window (container?) in the calling HTML. I've always wanted the moral equivalent of width=50% statement (of...
1
by: Tormod Omholt-Jensen | last post by:
need to dynamically insert an applet into a document. In IE 6.0 my code works fine, but there seems to be problems in Opera 7. The page looks like there is allocated space for an applet. ...
2
by: Put 030516 in email subj to get thru | last post by:
I've always been bothered about having to statically declare the size of a Java applet window (container?) in the calling HTML. I've always wanted the moral equivalent of width=50% statement (of...
8
by: DKM | last post by:
Here are the source code files to a Java applet that utilizes LiveConnect to communicate with Javascript, and the HTML file. The thing works both in IE 6.0 and FireFox 1.4. but with some...
1
by: 418928 | last post by:
Hi everybody, I would like to know if the way of communicating with an applet from Javascript is standard (valid for all web browsers). I know that JSObject (Applet->javascript) is not...
2
by: Richard Maher | last post by:
Hi, Recently on the web I came across documentation discussing Data Source Objects (DSO) in relation to browser and html functionality (in particular the ability to declare a Java applet as a...
3
by: javaBookWorm | last post by:
import java.applet.Applet; import java.awt.*; // Contains all of the classes for creating user interfaces and for painting graphics and images. import java.awt.event.*;//The root event class for...
2
Haitashi
by: Haitashi | last post by:
I have the following grid: <cfgrid name="gridChartType" delete="true" deletebutton="Remove" insert="true" insertbutton="Add" width="714" height="500" format="flash"...
1
by: sheephead86 | last post by:
Hi, I'm pretty new to java, and I have a small problem involving drawing a rectangle on a java applet.Firstly this is not a plea for someone to help me with this peice of work, I just need pointing...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.