I had a similar error and probem when using dropdown instead
of a check box. It was resolved by putting SELECT name="CarMake in
the drop down.
But in the checkbox, I don’t know?
I seems like the problem is the action page has the
Form.carmake but the entry page does not. What am I missing and
where do I put in the entry page below.
The key goal is to have checkboxes checked to insert values
into the database field carmake based on what is checked.
If the checkbox Honda is checked then
it inserts to the carmake field the value Honda.
If the checkbox Toyota is checked then
it inserts to the carmake field the value Toyota.
If both are checked then 2 records are inserted both values
Honda and Toyota.
Same for the last option.
Thanks for all your help
Here is the error again
error:
Error Occurred While Processing Request
Element CARMAKE is undefined in FORM.
12:21:50.050 - Expression Exception - in
C:\CFusionMX7\wwwroot\Author\CarAddAction.cfm : line 16
Element CARMAKE is undefined in FORM.
line 16 is:
'#Trim(Form.carmake)#',
Attach Code
<!------------here is the form------------>
<html>
<head>
</head>
<body>
<h1> </h1>
<table>
<cfform action="CarAddAction.cfm" method="POST">
<tr>
<td>Honda:</td>
<td><center><input type="checkbox"
name="HONDA_MODEL" value="HONDA"
checked></center></td>
</tr>
<tr>
<td>Toyota:</td>
<td><center><input type="checkbox"
name="Toyota_MODEL" value="Toyota"
Unchecked></center></td>
</tr>
<tr>
<td>SUBARU:</td>
<td><center><input type="checkbox"
name="SUBARU_MODEL" value="SUBARU"
unchecked></center></td>
</tr>
<tr><td>Honda Model</td>
<td>
<input type="Text"
name="Honda_Model"
Value=""
size="22"
maxlength="20">
</td>
<tr></tr>
<tr><td>Toyota Model</td>
<td>
<input type="Text"
name="Toyota_Model"
Value=""
size="22">
</td>
<tr></tr>
<tr><td>Subaru Model</td>
<td>
<input type="Text"
name="Subaru_Model"
Value=""
size="22">
</td>
<tr></tr>
<td> </td>
<td>
<input type="submit" value="Add make to Database">
</td>
</tr>
</cfform>
</table>
</body>
</html>
<!--------Action page
--------->
<cfdump var = "#form#">
<cfquery name="InsertCarInfo"
datasource="#Request.MainDSN#">
INSERT INTO Car_tab(
car_Make,
Honda_Model,
Toyota_Model,
Subaru_Model
)
VALUES (
'#Trim(Form.carmake)#',
'#Trim(Form.Honda_Model)#',
'#Trim(Form.Toyota_Model)#',
'#Trim(Form.Subaru_Model)#'
)
</cfquery>