473,403 Members | 2,293 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,403 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 7079
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...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

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.