Element RECORDCOUNT is undefined
I'm getting the above error message when using <cfif
Get_User_Vendors.RecordCount GT "0">. This has been working for
more than 2 years but started giving this error since few days, it
is weird. This error is coming if the stored procedure returns no
records. If there are some records it is not giving any error. I'm
using sql server 2000 database. I've attached the sample code. Any
solution is appreciated.
Thanks Daverms. It works. I'm not sure why it is behaving
only for the last few days. Onceagain thanks for your timely
help.
Similar Messages
-
Frame 11
DITA 1.2
I was finally able to create a DITA topic (rather than a reference, concept, or task). However, when I try to insert a task, concept, or reference element after the prolog, I get the following error message:
Element (concept [or task, or reference]) is undefined.
My Topic general rule looks like this:
title, titlealts?, abstract?, prolog>, body?, related links?, (topic | concept | task | reference)*
in the topic.eddmod.fm and has been imported into topic.edd.fm, and topictemplate.fm in addition to concept.edd.fm, reference.edd.fm and a whole boatload of others and their related templates.
Doesn't my general rule "define" concept, task, and reference? If not, what am I missing?
Thanks in advance all you helpful people.
MarshaHi Marsha...
Each "Element" node in the EDD is an "element definition" .. the EDD should contain an element definition for each element. The general rule in each element definition specifies the child elements allowed in that element.
If you're getting the message .. "Element SOMENAME is undefined" .. then that element definition is missing from the EDD. Perhaps some other "mod" inset file is corrupt and it's not loading properly.
Note that it's not DITA 1.2 that's a PITA, it's the way the default DITA 1.2 EDDs are set up that's a PITA. It doesn't have to be that way. Just flatten it and you'll be a happier camper. :-)
Cheers,
...scott -
Help with Element EMAIL is undefined in FORM
I am having issues getting my form to work properly after
moving my files in my repository into a trunk directory. It may not
be the reason things are failing now but it is the only change I
have made since yesterday when this code worked. Any help would be
greatly appreciated.
Element EMAIL is undefined in FORM.
The error occurred in C:\dev\b\trunk\content\contactnew.cfm:
line 139
137 : <!--- Send an e-mail to the proper group with the
form information --->
138 : <cfmail
139 : from="#form.email#"
140 : to="[email protected]"
141 : subject="Contact Us Form from"
Resources:
Check the
ColdFusion documentation
to verify that you are using the correct syntax.
Search the
Knowledge Base
to find a solution to your problem.
Browser Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1;
.NET CLR 1.1.4322; .NET CLR 2.0.50727)
Remote Address 127.0.0.1
Referrer
Date/Time 11-Nov-08 03:51 PM
Stack Trace (click to expand)
at
cfcontactnew2ecfm541056183.runPage(C:\dev\b\trunk\content\contactnew.cfm:139)
coldfusion.runtime.UndefinedElementException: Element EMAIL
is undefined in FORM.
at
coldfusion.runtime.CfJspPage.resolveCanonicalName(CfJspPage.java:1659)
at
coldfusion.runtime.CfJspPage._resolve(CfJspPage.java:1612)
at
coldfusion.runtime.CfJspPage._resolveAndAutoscalarize(CfJspPage.java:1747)
at
coldfusion.runtime.CfJspPage._resolveAndAutoscalarize(CfJspPage.java:1740)
at
cfcontactnew2ecfm541056183.runPage(C:\dev\b\trunk\content\contactnew.cfm:139)
at coldfusion.runtime.CfJspPage.invoke(CfJspPage.java:196)
at
coldfusion.tagext.lang.IncludeTag.doStartTag(IncludeTag.java:370)
at
coldfusion.filter.CfincludeFilter.invoke(CfincludeFilter.java:65)
at
coldfusion.filter.ApplicationFilter.invoke(ApplicationFilter.java:279)
at
coldfusion.filter.RequestMonitorFilter.invoke(RequestMonitorFilter.java:48)
at
coldfusion.filter.MonitoringFilter.invoke(MonitoringFilter.java:40)
at coldfusion.filter.PathFilter.invoke(PathFilter.java:86)
at
coldfusion.filter.ExceptionFilter.invoke(ExceptionFilter.java:70)
at
coldfusion.filter.ClientScopePersistenceFilter.invoke(ClientScopePersistenceFilter.java:2 8)
at
coldfusion.filter.BrowserFilter.invoke(BrowserFilter.java:38)
at
coldfusion.filter.NoCacheFilter.invoke(NoCacheFilter.java:46)
at
coldfusion.filter.GlobalsFilter.invoke(GlobalsFilter.java:38)
at
coldfusion.filter.DatasourceFilter.invoke(DatasourceFilter.java:22)
at coldfusion.CfmServlet.service(CfmServlet.java:175)
at
coldfusion.bootstrap.BootstrapServlet.service(BootstrapServlet.java:89)
at jrun.servlet.FilterChain.doFilter(FilterChain.java:86)
at
coldfusion.monitor.event.MonitoringServletFilter.doFilter(MonitoringServletFilter.java:42 )
at
coldfusion.bootstrap.BootstrapFilter.doFilter(BootstrapFilter.java:46)
at jrun.servlet.FilterChain.doFilter(FilterChain.java:94)
at jrun.servlet.FilterChain.service(FilterChain.java:101)
at
jrun.servlet.ServletInvoker.invoke(ServletInvoker.java:106)
at
jrun.servlet.JRunInvokerChain.invokeNext(JRunInvokerChain.java:42)
at
jrun.servlet.JRunRequestDispatcher.invoke(JRunRequestDispatcher.java:286)
at
jrun.servlet.ServletEngineService.dispatch(ServletEngineService.java:543)
at
jrun.servlet.jrpp.JRunProxyService.invokeRunnable(JRunProxyService.java:203)
at
jrunx.scheduler.ThreadPool$DownstreamMetrics.invokeRunnable(ThreadPool.java:320)
at
jrunx.scheduler.ThreadPool$ThreadThrottle.invokeRunnable(ThreadPool.java:428)
at
jrunx.scheduler.ThreadPool$UpstreamMetrics.invokeRunnable(ThreadPool.java:266)
at jrunx.scheduler.WorkerThread.run(WorkerThread.java:66)
Here is the code I am working on...I tried adding what you said to the document. The email is
not given when the form opens in the browser but is passed via the
form after it is filled out and submited. The email value should be
whatever the person adds to the email textbox. Again this was
working yesterday but has since stopped after I migrated my files
into a trunk directory in SVN.
Thanks for your reply. -
Need help with error message-Element SENDERBUSINESSNAME is undefined in MSG
Hi,
I am brand new to ColdFusion and am using a pre-built form for a contact form on a client's site. I added the additional field business name and must have missed something - any ideas on where I would need to define the element would be appreciated.
Thanks
MaggieTroubleshooting technique number 1 - look at your data. In this case, either msg doesn't exist, or it doesn't contain anything named senderbusinessname. Run the following line somewhere before the error occurs.
<cfdump var="#msg#"> -
This is occurring when I try to use the Upload Image server behavior in ADDT. I have used this server behavior so many times and have never seen this error message before. Does anyone have any ideas?
Jerbear85 wrote:
I am getting the same message while trying to insert data from a cfform to a database. The textboxes are named and id'd in the form.cfm, is there somewhere else the textbox names need to be defined like a code behind page or maybe even on the same .cfm?
No, ColdFusion has no "code behind" concept. You define a form by building a html form. If there is a html form input element named "template" and it is submitted it will exist in the "form" structure for the coresonding action cfml template.
There are some well known gotchas here. Radio and checkbox controls are only created if they are selected otherwise they do not exist.
A form method of "get" populates the URL scope, a form method of "post" populates the FORM scope.
These scopes only get populated on the immediate request from the submit action. Anything that causes the code to move to a new request such as <cflocation...> will not carry the URL or FORM data with it. -
Hi. Whenever I run this page (assuming that #FORM.EditMode# is "DeleteUser") I get
Element RECORDCOUNT is undefined in USEREDIT.
How can I get the RecordCount for the query?
The code is:
<cfquery name="UserEdit" datasource="AITE_Test_System">
<cfif #FORM.EditMode# IS "AddUser">
INSERT INTO dbo.[#FORM.UserType#] (Fname, Lname, AD_Username) VALUES ('#FORM.Fname#', '#FORM.Lname#', '#FORM.AD_Username#')
<cfelseif #FORM.EditMode# IS "DeleteUser">
DELETE FROM dbo.[#FORM.UserType#] WHERE Fname='#FORM.Fname#' AND LName='#FORM.LName#' AND AD_Username='#FORM.AD_Username#'
</cfif>
</cfquery>
...... NON COLDFUSION CODE HERE
<cfoutput>
<cfif #FORM.EditMode# IS "DeleteUser">
<cfif NOT #UserEdit.RecordCount# GTE 0>
User #FORM.Fname# #FORM.Lname# does not exist.<br />
<a href="index.cfm">Try Again</a>
<cfabort>
</cfif>
</cfif>
</cfoutput>
Thanks!Recordcount property only shows the records affected if you are using select statement. You can try the below code to get affected records on INSERT, UPDATE AND DELETE
<cfquery name="Test" datasource="test">
SET NOCOUNT ON
Delete from testTable WHERE firstname= 'Harpal'
SELECT deletecount=@@ROWCOUNT
SET NOCOUNT OFF
</cfquery>
<cfoutput>
recordcount:=#Test.deletecount#
</cfoutput> -
Recordcount on str.Proc. result
When my str. Proc. returning a query result and I use cfdump to see the resultset I can see it displays in my screen just fine.
but if the result of str. proc. is 0 my code throw an error :
Element RECORDCOUNT is undefined in Q_my_strproc_name.
The error points to the following code:
<cfif Q_my_strproc_name.recordcount NEQ 0>
......etc
How can I prevent error when the str proc. does not return any result if I can't use Q_my_strproc_name.recordcount?
Thank you for any help.Hi,
Please try this,
<cfif isdefined("Q_my_strproc_name") AND Q_my_strproc_name.recordcount GT 0>
</cfif> -
I have a problem with displaying records from my database where I wish to navigate through the records.
I use a framset where I gather the search data in a form on the left side of the page and display the database results in a frame on the right hand side of the page.
The website I have displays 1 record at a time in a table format. There's no problem getting records from the database - if I try to display 1 record on the page its Ok, if I disply X records on the page its fine - the problem comes where I display 1 record and then use hyperlinks to move to the next record in data set.
The code is set so the navigation links only appear where there is more than 1 matching record so I know I'm not trying to call records that do not exist.
The error only appears when I try to navigate through the records to display te 2nd record returned by any search, it appears to be something to do with the RecordCount.
Any help appreciated.
For Reference the next/prev record is adapated from here - http://tutorial20.easycfm.com/#
The error is:
[quote]
Element RECORDCOUNT is undefined in GETDATABASESEARCHRESULT.
The error occurred in *****/testquery.cfm: line 36
34 :
35 : <CFSET end=Start + disp>
36 : <CFIF start + disp GREATER THAN GetDatabaseSearchResult.RecordCount>
37 : <CFSET end=999>
38 : <CFELSE>
[/quote]
The website code is:
[quote]
<!--- Start is the default starting row for the output.
Disp determines how many records to display at a time --->
<!--- Start displaying with record 1 if not specified via url --->
<CFPARAM name="start" default="1" />
<!--- Number of records to display on a page --->
<CFPARAM name="disp" default="1" />
<!--- Holds variables passed from form on prev page when this page is called.--->
<CFPARAM Name="Form.Forename" Default="">
<CFPARAM Name="Form.Surname" Default="">
<CFPARAM Name="Form.Battalion" Default="">
<HTML>
<HEAD>
</HEAD>
<BODY>
<!--- query the database table. Cache the result set for 15 minutes. --->
<CFIF #Form.Battalion# IS "Sixth" >
<CFQUERY NAME="GetDatabaseSearchResult" DATASOURCE="durhamli_durhamli"
CACHEDWITHIN="#CreateTimeSpan(0,0,15,0)#">
SELECT Surname,Forename, Pre1917ServiceNumber, Post1917ServiceNumber, Battalion, YearOfBirth, DateEnlisted, PlaceEnlisted, DateOverseas, Notes
FROM SixthDLI
WHERE Forename LIKE '%#Form.Forename#%' AND Surname LIKE '%#Form.Surname#%'
</CFQUERY>
</CFIF>
<CFSET end=Start + disp>
<CFIF start + disp GREATER THAN GetDatabaseSearchResult.RecordCount>
<CFSET end=999>
<CFELSE>
<CFSET end=disp>
</CFIF>
<!--- Output the range of records displayed on the page as well as the total
number of records in the result set --->
<CFOUTPUT query="GetDatabaseSearchResult" startrow="#start#" maxrows="#end#">
<table border="2" cellpadding="5" cellspacing="2" width="90%" cols="5">
<th>Surname</th>
<th>Forename</th>
<th>Pre1917 No.</th>
<th>Post1917 No.</th>
<th>Battalion</th>
<tr>
<td>
#GetDatabaseSearchResult.Surname#
</td>
<td>
#GetDatabaseSearchResult.Forename#
</td>
<td>
#GetDatabaseSearchResult.Pre1917ServiceNumber#
</td>
<td>
#GetDatabaseSearchResult.Post1917ServiceNumber#
</td>
<td>
#GetDatabaseSearchResult.Battalion# Battalion
</td>
</tr>
<th>Year Born</th>
<th>Date Enlisted</th>
<th colspan="2">Place</th>
<th>Posted Overseas</th>
<tr>
<td>
#GetDatabaseSearchResult.YearOfBirth#
</td>
<td>
#GetDatabaseSearchResult.DateEnlisted#
</td>
<td colspan="2">
#GetDatabaseSearchResult.PlaceEnlisted#
</td>
<td>
#GetDatabaseSearchResult.DateOverseas#
</td>
</tr>
<th colspan="5" align="left">Notes</th>
<tr>
<td colspan="5">
#GetDatabaseSearchResult.Notes#
</td>
<tr>
</table>
Record Number : #CurrentRow# of #GetDatabaseSearchResult.RecordCount#
</CFOUTPUT>
<!--- displays the navigation hyperlinks for the required recordset --->
<CFOUTPUT>
<table border="0" cellpadding="10">
<tr>
<!--- Display prev link --->
<CFIF start NOT EQUAL 1>
<CFIF start GTE disp>
<CFSET prev=disp />
<CFSET prevrec=start - disp />
<CFELSE>
<CFSET prev=start - 1 />
<CFSET prevrec=1 />
</CFIF>
<!--- only displays link if more than 1 record returned--->
<CFIF #GetDatabaseSearchResult.RecordCount# GT 1>
<td><font face="wingdings">ç</font> <a href="testquery.cfm?start=#prevrec#"> Previous #prev# record</a></td>
<CFELSE>
</CFIF>
</CFIF>
<!--- Display next link --->
<CFIF end LT GetDatabaseSearchResult.RecordCount>
<CFIF start + disp * 2 GTE GetDatabaseSearchResult.RecordCount>
<CFSET next=GetDatabaseSearchResult.RecordCount - start - disp + 1 />
<CFELSE>
<CFSET next=disp />
</CFIF>
<!--- only displays link if more than 1 record returned--->
<CFIF #GetDatabaseSearchResult.RecordCount# GT 1>
<a href="testquery.cfm?start=#Evaluate("start + disp")#">Next record</a> <font face="wingdings"></td>
<CFELSE>
</CFIF>
</cfif>
</tr>
</table>
</CFOUTPUT>
</BODY>
</HTML>
[/quote]Thanks, you've nailed it.
I hadn't set a default parameter for form.battalion (although I presumed it would retain the parameter passed from the form to the query when I initially create the datbase query) and it now seems to work for now. It must clear the form variables every tim the page refreshes as it changes record.
I'm not sure how it'll work when I add the 4 extra tables - 'Fifth', 'Seventh', 'Eigth' and 'Ninth' if it clears the value passed from the form each time the page refreshes I suspect it's going to default to the value set on the CFPARAM tag each time but I'll deal with that at the time. -
*ERROR* Element form.someVariable is undefined in form
Hi all. I have had CF7 install for a few months and have been
building my site ever since. Now that my site is nearing the end of
construction I need to deal with this problem. I thought it was
normal! But I starting searching forums for the problem and it
appears to be rare and intermittent for most.
For example: If I try to access a page directly that has a
cfquery on it such as <cfquery..../> SELECT* FROM table WHERE
city = '#form.myCity'</cfquery> I get this error :
Element MYCITY is undefined in FORM.
it does not to it so much when I use the browser's back
button but it prevents me from using page navigation links and
<cflocation url=" " addtoken="no"> tags.
This may also help with diagnosis:
As I said, the problem has always been there but I recenty
switched to flash formatted forms and even though I have timeout
set to 999 and preserve data set to yes, if a user makes a mistake
and has to go back even within a second, all data is lost and they
have to start over. Could it be that CFIDE is in C: and my site is
behind inetpub/wwwroot/site_root ?Surround the code block containing the query with
<cfif isDefined("form.myCity")>
</cfif> -
I have a test code like this:
<cfquery name="detail" datasource="fundfinder1"
dbtype="ODBC">
SELECT edtrans.*, edtrans.princ_amt as tr_princ_amt,
edtrans.income AS tr_income, edtrans.Val_share AS
tr_val_share, edtrans.shares AS tr_shares
FROM edtrans
WHERE princ_acc = '480377'</cfquery>
<cfoutput>#detail.tr_val_share#</cfoutput>
It returns message: "Element TR_VAL_SHARE is undefined in
DETAIL"
if I change tr_val_share to trvalshare(without _) it works.
please help?If you do this, what do you get for the problematic field?
<cfquery name="q1">
select * from edtrans where 1 = 2
</cfquery>
<cfdump var="#q1.columnlist#"> -
Element undefined. What am I missing here?
I can't seem to get this template to work correctly. As it is now it generates the following error message;
Element PRODUCTTYPE is undefined in PRODUCTS.
Here is my code;
<cfquery datasource="farmky" name="getProductLists">
SELECT CatalogGroup.ID,
CatalogGroup.Group,
Products.ProductID,
Products.Manufacturer,
Products.ProductTitle,
Products.CatalogGroup,
Products.ProductType,
ProductTypes.ID,
ProductTypes.ProductType
FROM ProductTypes INNER JOIN (CatalogGroup INNER JOIN Products ON CatalogGroup.ID = Products.CatalogGroup) ON ProductTypes.ID = Products.ProductType
ORDER BY ProductTitle ASC
</cfquery>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<body>
<cfdump var="#getProductLists#">
<cfoutput query="getProductLists" group="#Products.ProductType#">
<table width="850" border="0">
<tr>
<td colspan="3" bgcolor="##CCCCCC"><strong>#ProductTypes.ProductType#</strong></td>
</tr>
<cfoutput><tr>
<td width="236" align="left">#ProductTitle#</td>
<td width="254" align="left">#Manufacturer#</td>
<td width="212" align="left">#Group#</td>
</tr></cfoutput>
</table></cfoutput>
</body>
</html>
The results of my <cfdump> do not show anything for the ProductTypes.ProductType column. I suspect the issue is with either my JOIN statements in my FROM clause or my group syntax or both. Any help on this would be greatly appreciated. Thanks in advance.Thanks for the response Dave. I modified my code as per your suggestion and am now getting this error message;
Variable PRODUCTS_PRODUCTTYPE is undefined.
Here is the new code;
<cfquery datasource="farmky" name="getProductLists">
SELECT CatalogGroup.ID AS CatalogGroup_ID,
CatalogGroup.Group,
Products.ProductID,
Products.Manufacturer,
Products.ProductTitle,
Products.CatalogGroup,
Products.ProductType AS Products_ProductType,
ProductTypes.ID AS ProductTypes_ID,
ProductTypes.ProductType AS ProductTypes_ProductType
FROM ProductTypes INNER JOIN (CatalogGroup INNER JOIN Products ON CatalogGroup.ID = Products.CatalogGroup) ON ProductTypes.ID = Products.ProductType
ORDER BY ProductTitle ASC
</cfquery>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Central Farm Supply of Kentucky, Inc.</title>
</head>
<body>
<cfdump var="#getProductLists#">
<cfoutput query="getProductLists" group="#Products_ProductType#">
<table width="850" border="0">
<tr>
<td colspan="3" bgcolor="##CCCCCC"><strong>#ProductTypes_ProductType#</strong></td>
</tr>
<cfoutput><tr>
<td width="236" align="left">#ProductTitle#</td>
<td width="254" align="left">#Manufacturer#</td>
<td width="212" align="left">#Group#</td>
</tr></cfoutput>
</table></cfoutput>
</body>
</html>
My <cfdump> is showing the correct results for the ProductTypes.ProductType column whereas before it showed no results at all.
EDIT: I removed the #'s from the group="Products_ProductType" and now the page displays correctly except for the order. I modified the Order By clause to ORDER BY Products_ProductType, ProductTitle ASC and now get an error message stating Too few parameters. Expected 1. Thoughts? -
Hi-
I've been assinged to create some .cfm screens for our web
page. I have absolutely NO Cold Fusion or HTML background. I do
have some introductory C++, C# and VB background. I'm using
Dreamweaver to create the pages with ColdFusion.
Our website is used to view data, not to submit any
infomration on forms. The first time a user hits my form called
detail_staging.cfm an SQL statement runs that passes three
variables from the previous screen using:
SELECT stuff
FROM stuff's table
WHERE card_data.card_year = <CFQUERYPARAM value="#URL.FY#"
CFSQLTYPE="cf_sql_char"> AND
card_data.card_month= <CFQUERYPARAM value="#URL.MON#"
CFSQLTYPE="cf_sql_char"> AND
agencydim.agy_agency_name=<cfqueryparam value="#URL.AGN#"
cfsqltype="cf_sql_char">
This works great and displays informtion based on year, month
and agency. I then want the user to be able to change the month,
but keep the year and agency. I added:
<FORM action="detail_staging.cfm" method="get">
<div align="center"><span
class="page_text_bold">Select Month:</span>
<select name="Month"
class="page_text_side_header_content">
<cfoutput query="Month">
<option
value="#CALENDAR_MONTH#">#CALENDAR_MONTH#</option>
</cfoutput>
</select>
<input type="submit" value="go">
</div>
</FORM>
CALENDAR_MONTH is populated in the drop down based on the
query 'Month'
HERE'S THE PROBLEM:
When I try to change the month, I get "Element FY is
undefined in URL" How do I keep the variable value for FY and AGN
that came through the first time the page loaded and change only
the month?
I've been trying to find an answer to this for a day and a
half now and I'm hoping that you all can help me.
Thank you very much,
WendyThanks for your reply. I'm still not getting it. The stuff I
looked up
says to put an input inside the form tag, but when I do that,
it wants a
name - so I named it-
Now, it doesn't display anything. Is there something I'm
missing or a
more specific direction you can point me in.
Did you also put it into the <cfoutput> block so that
the url variable
is resolved into it's value?
<FORM action="detail_staging.cfm" method="get">
<div align="center"><span
class="page_text_bold">Select Month:</span>
<select name="Month"
class="page_text_side_header_content">
<cfoutput query="Month">
<option
value="#CALENDAR_MONTH#">#CALENDAR_MONTH#</option>
</cfoutput>
</select>
<cfoutput><!--- This block passes through the other
form values --->
<input type="hidden" name="FY" value="#url.fy#">
<input type="hidden" name="AGN" value="#url.AGN#">
</cfoutput>
<input type="submit" value="go">
</div>
</FORM>
You will also need your select name to match the url name you
use in the
query. They both need to be either "MON" or "Month". -
I've been having a particularly annoying error with ColdFusion 11, and unable to track down the source of this problem.
Basically There are a few variables defined in the session scope we check with isdefined a few lines above to make sure they are defined. Subsequent lines may or may not throw a #variablename# is undefined on random lines.
What can I do to fix this issue? Is this a known bug?I am doing isDefined checks for relevant variables when neccessary. The problem is not that the code errors out undefined ... it's that the variable is actually defined and errors out undefined.
As a simplified example;
Login.cfm Form supplies form.username and form.password to login_action.cfm then redirects to index.cfm after succesful LDAP authentication. I will not include all lines as it would be too long.
Login_action.cfm
<cfinclude template="ldap.cfm">
<!--- LDAP login code goes here; checks if credential's supplied are valid and sets variable #logged_in# ... --->
<cftry>
<cfif isdefined("logged_in") and logged_in>
<!--- Create Session User Structure and Default Profile --->
<cfset session.user=StructNew()>
<cfset session.user.username=form.username>
<cfset session.user.firstname="">
<cfset session.user.surname="">
<cfset session.user.email="">
<!--- Pull in additional Details --->
<cfquery name="qDetails" datasource="userdetails">
SELECT firstname,surname,email FROM Profiles
WHERE username = '#session.user.username#'
</cfquery>
<cfif isdefined("qDetails") and qDetails.recordcount>
<cfoutput query="qDetails">
<cfset session.user.firstname ="#qDetails.firstname#">
<cfset session.user.surname="#qDetails.surname#">
<cfset session.user.email="#qDetails.email#">
</cfouput>
</cfif>
<cfelse>
<!--- Throw Error back to login page --->
<cfthrow message="1" type="Custom_Security" ErrorCode="Fail">
</cfif>
<cfcatch type="any">
<!--- Throw Error back to login page --->
<cfthrow message="2" type="Custom_Security" ErrorCode="Fail">
</cfcatch>
</cftry>
<!--- Redirect User to login page after Successful Login --->
<cflocation url="index.cfm">
Index.cfm
<!--- At Top of Index session.user.email always exists, in the event it is undefined it will be set to "" --->
<cfparam name="session.user.email" default="">
<!--- Lots of lines of code above here build HTML page etc <cfoutput> references to #session.user.email# and other session vars --->
<!--- Example pull some more information this line may or may not error... --->
<cfquery name="qUserInformation" datasource="userdetails">
SELECT * FROM Information
WHERE user_email = '#session.user.email#'
ORDER BY SomeOtherColumn
</CFQUERY>
<!--- Example point where a session error can be generated less than 2 lines above it has just finished getting information using session.user.email --->
<cfquery name="qUserGroups" datasource="userdetails">
SELECT * FROM Groups
WHERE user_email = '#session.user.email#'
ORDER BY SomeColumn
</CFQUERY>
<!--- Some other common examples require cfscript - and throw errors; above lines may not ... --->
<cfscript>
oHomePage=CreateObject("component","site_components.homepage");
qNews=oHomePage.getNews("#session.user.category#");
</cfscript>
<!--- More lines to do with HTML Footer etc <cfoutput> more stuff --->
in the wwwroot the Application.cfm handles all errors generated during rendering of the page, which includes generating a cfdump of the session scope.
When I get the Error Log I can see in the cfcatch cfdump the error... Element USER.EMAIL UnDefined in SESSION.
struct
Browser
Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/37.0.2062.124 Safari/537.36
DateTime
{ts '2014-09-28 11:38:48'}
Diagnostics
Element USER.EMAIL is undefined in SESSION. <br>The error occurred on line 15.
However when I check the SESSION scope which is also dumped ... It is defined!
struct
user
struct
COLOR
cccccc
EMAIL
[email protected]
FIRSTNAME
Example
SURNAME
Surname
EXAMPLE1
1
TEMPLATE
template14
TEMPLATE_DETAILS
0
What is causing this strange and irratic behaviour? The problem is so far I cannot replicate the issue. It is intermittant. The issue only started after upgrading to ColdFusion 11. This code has worked flawlessly for years on CF8. -
Element Undifined in form error.
Hi,
I have the following code:
There will be as many hidden fields as the number of rows
retrieved by the query "getCities". Each is distinguished with the
value of level_detail_uid for each loop.
city.cfm
<html>
<head>
<title>Update </title>
<script language="JavaScript">
function delete_city(level_detail_uid,city_id ,cnam)
if ( confirm("Are you sure to delete the pricing-information
for " + city_id + " ?") )
window.location =
'city_pricing_display.cfm?delete_level_detail_uid=' +
level_detail_uid +
'&delete_city_name=' + city_id + '&del_cnam=' +
cnam;
<cfif isDefined("delete_level_detail_uid") and
delete_level_detail_uid is NOT "">
<cfoutput> #del_cnam#</cfoutput>
<cftransaction>
</cfquery>
</cfif>
</cftransaction>
</cfif>
<form method="POST" name="city_details"
action="city_update_pop.cfm">
<table border="0" cellspacing="0" cellpadding="0"
width="100%">
<tr>
<td>
<cfquery name="getCities"
datasource="#application.alcdatasource#">
SELECT city_name, dtl.level_detail_uid,
FROM alc_pricing_level_details dtl, alc_city c,
alc_detail_provider prvdr
WHERE level_desc_uid = #level_desc_uid#
AND dtl.level_detail = c.city_id(+)
AND prvdr.level_detail_uid = dtl.level_detail_uid
ORDER BY upper(city_name)
</cfquery>
<cfloop query="getCities">
<cfoutput>
<input type="hidden" name="cityname_#level_detail_uid#"
value="#getCities_city_name#">
</cfoutput>
<td>
<a
href="JavaScript:delete_city('#level_detail_uid#','#city_id#','#form.cityname_#level_deta il_uid##')"
class="PageInnerNavigationHeadingSmall">Delete City</a>
</td>
</table>
</body>
</form>
</html>
Suppose the level_detail_uid is 12345.
After executing this it says
"element cityname_ is undefined in form
Please kindly help.....
Thanking in advance....
Regards,
Aswathy.I agree with cf_matt. There are several problems with the
code. The field form.cityname_#level_detail_uid# won't exist when
the form is first loaded. So you can't use it in your link unless
you define a default value first
<a
href="JavaScript:delete_city('#level_detail_uid#','#city_id#','#form.cityname_#level_deta il_uid##')"
>...</a>
Also, the syntax to retreive the value is wrong. Assuming the
variable is defined, try using array notation
#form["cityname_#level_detail_uid#"]# -
I have tried this multiple ways and I keep getting element undefined errors. Basically I am created an edit form using the developer toolbox create dynamic form wizard. I have added a recordset to this form that I will query a database to find an entry based on a value on the form, but I cannot seem to get the query to recognize the form field and pul it's value.
Query
<cfquery name="officers" datasource="tnmpUsers">
SELECT ID, fullname, email, Initials, Clerk, is_officer, alwaysshow
FROM users.users
WHERE is_officer = 1
AND alwaysshow = 1
AND fullname LIKE <cfqueryparam value="#FORM.usponame_<cfoutput>#cnt1#</cfoutput>#" cfsqltype="cf_sql_char">
ORDER BY fullname ASC
</cfquery>
This gives the following
Invalid CFML construct found on line 61 at column 55.
So I try using the same reference that the field uses for it's value which is
<cfoutput>#Request.KT_escapeAttribute(rspsidb.usponame)#</cfoutput> which givews the following error.
"Element USPONAME is undefined in RSPSIDB"
Here is the code for the field that holds the value I want.
<input type="text" name="usponame_<cfoutput>#cnt1#</cfoutput>" id="usponame_<cfoutput>#cnt1#</cfoutput>" value="<cfoutput>#Request.KT_escapeAttribute(rspsidb.usponame)#</cfoutput>" size="32" maxlength="100" />
I have done this before with webpages I created, and it should be fairly easy, and I am probably missing something very simple, but can't find it. The field works fine, and has the value I need, I just can't seem to reference it from the cfquery.
any help appreciated, Thanks!
I also tried the following for the AND statement, but still a no go.
AND fullname = #usponame_<cfoutput>#cnt1#</cfoutput>#Hi there,
first I have to admit that I can´t tell why this doesn´t work with ColdFusion in particular (I´m a PHP guy), but I reckon that it doesn´t work because #cnt1# is a sort of placeholder which - once ADDT´s Dynamic Form is loaded in a browser - actually represents a variable number which - in turn - depends on the number of form instances which have been rendered by selecting one or multiple records in the Dynamic List.
That said, the actual input field´s name (and id) could be "usponame_1" or "usponame_3", but it´s never a simple name like "usponame", and it´s most probably not a predictable value which your query might be able to recognize - because unlike a traditional "update a single recordset only" form ADDT´s Dynamic Forms may (or may not, depending on your previous selection in the corresponding Dynamic List) consist of multiple instances, whereas your query expects a single value that´s derived from a "known" form field name
Humm, I hope this makes a little sense ;-)
Cheers,
Günter
Maybe you are looking for
-
I have a 2nd generation Ipod. I have it connected to my computer and see (my name) ipod on my screen. Everytime I try to add a new song to the Ipod, this message comes up and I am not sure what to do: The Ipod, (my name) is synced with another ITunes
-
New contract, new hub, same broadband speed.
Went online to look at my broadband options - it suggested I could get 12-17MB/s on a new contract. So I rang and got a new contract. The new hub arrived, works great. Now, when I go online to bt.com and run the speed estimator, it suggests I could g
-
IWeb: problem with comments
On my iWeb page I have comments allowed on my blog. Yet no one can post comments. If I publish a new article with the comments allowed, iWeb comes back with an error server message. Mac OS X 10.5.4 iWeb 2.0.4
-
Oracle - Microsoft Odbc Error while installing UPK on Server 2008 64 bit..
upk VERSION: 3.5.1 os: windows 2008 server 64 bit oracle: 11g.1 for 64 bit i have created a user with sysdba and other privileges and i am able to login into database as well. but when i try to run the UPK ( server) installer and select the ORacle da
-
WEBUTIL Install/java init error
I am trying to run WEBUTIL in my pc in a development environment but can get the applet to start when I add webUtilArchive=/forms90/webutil/webutil.jar,/forms90/webutil/jacob.jar to my formsweb.cfg file. If I add it I get a java.lang.ExceptionInIniti