I apparently pasted the wrong code (although there is not much difference
between it and this) since my alert() is different here... but this is what
I have up and running fine...
<cfset empdata = querynew("user_last_name,user_first_name,user_email") />
<cfset queryaddrow(empdata) />
<cfset querysetcell(empdata, "user_first_name", "Bobby") />
<cfset querysetcell(empdata, "user_last_name", "Hartsfield") />
<cfset querysetcell(empdata, "user_email", "[EMAIL PROTECTED]") />
<cfset queryaddrow(empdata) />
<cfset querysetcell(empdata, "user_first_name", "Bobby") />
<cfset querysetcell(empdata, "user_last_name", "Hartsfield") />
<cfset querysetcell(empdata, "user_email", "[EMAIL PROTECTED]") />
<cfsavecontent variable="onchange">
if(employee_grid.dataProvider[employee_grid.selectedIndex]['user_email']==''
)
{
alert('Please enter an email address');
}
</cfsavecontent>
<cfform name="GridForm" action="cfgrid3.cfm" format="flash" timeout="200">
<cfgrid name="employee_grid"
query="empdata" selectmode="edit" insert="yes" delete="yes"
rowheaders="no"
format="flash"
height="200"
onchange="#onchange#" />
<br>
<cfinput type="Submit" name="test" value="Submit">
</cfform>
When you change selections, the SELECTED index's user_email is checked
against ''
**be sure to check for wrapping of the if(){} statement caused by email
reformatting**
It should be 4 lines...wrapping it will cause it to fail.
if()
{
alert();
}
Dont mind the query object above the first <cfsavecontent> tag... its just
a mock up query rather than making a real database/table.
..:.:.:.:.:.:.:.:.:.:.:.:.:.:.
Bobby Hartsfield
http://acoderslife.com
-----Original Message-----
From: Nick Han [mailto:[EMAIL PROTECTED]
Sent: Tuesday, November 22, 2005 12:39 PM
To: CF-Talk
Subject: RE: easy cfgrid question
It's not empty. The email value is visible on the grid.
-----Original Message-----
From: Bobby Hartsfield [mailto:[EMAIL PROTECTED]
Sent: Monday, November 21, 2005 7:35 PM
To: CF-Talk
Subject: RE: easy cfgrid question
Because your email field is empty maybe?
Try
alert("Enter an email address");
instead
....:.:.:.:.:.:.:.:.:.:.:.:.:.:.
Bobby Hartsfield
http://acoderslife.com
-----Original Message-----
From: Nick Han [mailto:[EMAIL PROTECTED]
Sent: Monday, November 21, 2005 10:01 PM
To: CF-Talk
Subject: RE: easy cfgrid question
Bobby,
I am getting a blank value in the alert box with either
alert(employee_grid.dataProvider[employee_grid.selectedIndex]['user_emai
l'].text);
or
alert(employee_grid.dataProvider[employee_grid.selectedIndex]['user_emai
l']);
I don't see the value passed from the cfgrid.
-----Original Message-----
From: Bobby Hartsfield [mailto:[EMAIL PROTECTED]
Sent: Monday, November 21, 2005 6:49 PM
To: CF-Talk
Subject: RE: easy cfgrid question
<cfsavecontent variable="onchange">
if
(employee_grid.dataProvider[employee_grid.selectedIndex]['user_email']
==
'')
{
alert('Please enter an email address');
}
</cfsavecontent>
<cfform name="GridForm" action="cfgrid3.cfm" format="flash"
timeout="200">
<cfgrid name="employee_grid"
query="empdata" selectmode="edit" insert="yes"
delete="yes"
rowheaders="no"
format="flash"
height="200"
onchange="#onchange#" />
<br>
<cfinput type="Submit" name="test" value="Submit">
</cfform>
This is just an example, its not going to work for what you are trying
to
do. You wont want to do it on change but rather submit and youll want to
loop over all of the dataprovider checkin the emails, not just a
specific
one. But this should give you a good idea of how to reference them.
Hope it helps.
(I also couldn't think of the length check function in flash but youll
want
atleast that rather than == '')
......:.:.:.:.:.:.:.:.:.:.:.:.:.:.
Bobby Hartsfield
http://acoderslife.com
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Logware (www.logware.us): a new and convenient web-based time tracking
application. Start tracking and documenting hours spent on a project or with a
client with Logware today. Try it for free with a 15 day trial account.
http://www.houseoffusion.com/banners/view.cfm?bannerid=67
Message: http://www.houseoffusion.com/lists.cfm/link=i:4:224988
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54