my code is:
addRecord.cfm
addRecordAction .cfm
but i got following error while inserting the record:
--------------------------------------------------------------------------------
addRecord.cfm
Code:
<cfinclude template="head.cfm">
<p>
<table width="100%" border="0" align="center" cellpadding="2" cellspacing="0">
<tr>
<td>
<div align="center">
<P align="left"><strong><font size="+1">Add a New Record </font></strong></P>
<p align="left">Add your record: </p>
<form method="post" action="addRecordAction.cfm">
<input type="Hidden" name="Name_Required" Value="You must have a Name!">
<input type="Hidden" name="Address_Required" Value="You must have an Address!">
<table width="100%" border="0" cellspacing="0" cellpadding="2">
<tr>
<td width="25%"><p><strong>Name:</strong></p></td>
<td width="75%"><p>
<input type="text" name="Name" size="40" maxlength="50">
</p></td>
</tr>
<tr>
<td> </td>
<td> </td>
</tr>
<tr>
<td width="25%"><p><strong>Address:</strong></p></td>
<td width="75%"><p>
<input type="text" name="Address" size="40" maxlength="50">
</p></td>
</tr>
</table>
<BR>
<div align="left">
<input type="submit" name="SubmitButton" value="Add the Record">
<input type="reset" name="ResetButton" value="Reset">
</div>
</form>
</div>
</td>
</tr>
</table>
<cfinclude template="foot.cfm">
addRecordAction .cfm
Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Add a Record</title>
</head>
<body>
<!--- Set the data that is to be updated and the tables they apply to --->
<cfquery name="InsertName" datasource="test">
INSERT
INTO Name
(Name)
VALUES
('#Form.Name#')
</cfquery>
<cfquery name="getLastID" datasource="test">
SELECT MAX(NameID) as LastID
FROM Name
</cfquery>
<cfloop list="#form.Address#" index="FormAddress" delimiters=":">
<cfquery name="InsertAddress" datasource="test">
INSERT INTO Address(NameID, Address)
VALUES('#getLastID.LastID#','#FormAddress#')
</cfquery>
</cfloop>
<cflocation url="addRecord.cfm">
</body>
</html>
but i got following error while inserting the record:
Code:
Error Occurred While Processing Request
Element NAME is undefined in FORM.
The error occurred in C:\CFusionMX\wwwroot\jesmi\record\FusionPoll\Admin\polladdaction.cfm: line 15
13 : (Name)
14 : VALUES
15 : ('#Form.Name#')
16 : </cfquery>
17 :
Code:
Please try the following: 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 6.0; Windows NT 5.1) Remote Address 127.0.0.1 Referrer Date/Time 27-Apr-07 11:52 PM Stack Trace (click to expand) at cfpolladdaction2ecfm1868478318.runPage(C:\CFusionMX\wwwroot\jesmi\record\FusionPoll\Admin\polladdaction.cfm:15) coldfusion.runtime.UndefinedElementException: Element NAME is undefined in FORM. at coldfusion.runtime.CfJspPage.resolveCanonicalName(CfJspPage.java:1049) at coldfusion.runtime.CfJspPage._resolve(CfJspPage.java:1026) at coldfusion.runtime.CfJspPage._resolveAndAutoscalarize(CfJspPage.java:1125) at cfpolladdaction2ecfm1868478318.runPage(C:\CFusionMX\wwwroot\jesmi\record\FusionPoll\Admin\polladdaction.cfm:15) at coldfusion.runtime.CfJspPage.invoke(CfJspPage.java:147) at coldfusion.tagext.lang.IncludeTag.doStartTag(IncludeTag.java:357) at coldfusion.filter.CfincludeFilter.invoke(CfincludeFilter.java:62) at coldfusion.filter.ApplicationFilter.invoke(ApplicationFilter.java:107) at coldfusion.filter.PathFilter.invoke(PathFilter.java:80) at coldfusion.filter.ExceptionFilter.invoke(ExceptionFilter.java:47) at coldfusion.filter.ClientScopePersistenceFilter.invoke(ClientScopePersistenceFilter.java:28) at coldfusion.filter.BrowserFilter.invoke(BrowserFilter.java:35) at coldfusion.filter.GlobalsFilter.invoke(GlobalsFilter.java:43) at coldfusion.filter.DatasourceFilter.invoke(DatasourceFilter.java:22) at coldfusion.CfmServlet.service(CfmServlet.java:105) at jrun.servlet.ServletInvoker.invoke(ServletInvoker.java:91) at jrun.servlet.JRunInvokerChain.invokeNext(JRunInvokerChain.java:42) at jrun.servlet.JRunRequestDispatcher.invoke(JRunRequestDispatcher.java:252) at jrun.servlet.ServletEngineService.dispatch(ServletEngineService.java:527) at jrun.servlet.http.WebService.invokeRunnable(WebService.java:168) at jrunx.scheduler.ThreadPool$DownstreamMetrics.invokeRunnable(ThreadPool.java:348) at jrunx.scheduler.ThreadPool$ThreadThrottle.invokeRunnable(ThreadPool.java:451) at jrunx.scheduler.ThreadPool$UpstreamMetrics.invokeRunnable(ThreadPool.java:294) at jrunx.scheduler.WorkerThread.run(WorkerThread.java:66)
Comment