jcpatterson
asked on
ColdFusion 8: Element PARENTID is undefined in URL
I have an CF8 action page to update a table and am getting the following error:
Element PARENTID is undefined in URL.
The error occurred in C:\ColdFusion8\wwwroot\PET \Parent\in actParent. cfm: line 6
4 : UPDATE ParentSchoolTbl
5 : SET ActiveYN = '#Trim(frmInact.ActiveYN)# '
6 : WHERE ParentID=#URL.ParentID# and Form.DistrictIDFK = #Session.DistrictIDFK#
7 : </CFQUERY>
8 :
When I use the WHERE ParentID=#URL.ParentID# in a CFINSERT statement it works. I don't understand why it isn't working in this case. I'm out of ideas. I would appreciate some advice on what I am doing wrong. I have attached the code snippet: Snippet ID=5898270
Thank you.
John
Element PARENTID is undefined in URL.
The error occurred in C:\ColdFusion8\wwwroot\PET
4 : UPDATE ParentSchoolTbl
5 : SET ActiveYN = '#Trim(frmInact.ActiveYN)#
6 : WHERE ParentID=#URL.ParentID# and Form.DistrictIDFK = #Session.DistrictIDFK#
7 : </CFQUERY>
8 :
When I use the WHERE ParentID=#URL.ParentID# in a CFINSERT statement it works. I don't understand why it isn't working in this case. I'm out of ideas. I would appreciate some advice on what I am doing wrong. I have attached the code snippet: Snippet ID=5898270
Thank you.
John
Form Page:
<cfoutput>
<input type="hidden" name="UserName" value="#Session.UserName#">
<input type="hidden" name="District" value="#Session.DistrictIDFK#">
<input type="hidden" name="School" value="#Session.SchoolIDFK#">
</cfoutput>
<CFSET ParentID="#GetParent.ParentID#">
<CFSET SchoolIDFK="#GetParent.ParentSchoolIDFK#">
<CFSET ActiveYN="#GetParent.ActiveYN#">
<cfoutput>
School List for #GetParent.ParentFirstN# #GetParent.ParentLastN#
</cfoutput>
<br>
<br>
<cfform name="frmInact" action="inactParent.cfm">
<table>
<CFOUTPUT QUERY="GetParent">
<cfinput type="hidden" name="ParentID" value="#URL.ParentID#">
<cfinput type="hidden" name="DistrictIDFK" value="#Session.DistrictIDFK#">
<tr><td><cfinput type="hidden" name="SchoolIDFK" value="#SchoolIDFK#"></td><td>#SchoolName# </td>
<td>Active?</td><td>
<CFIF ActiveYN IS "True">
<CFINPUT TYPE="Checkbox" NAME="ActiveYN" checked>
<CFELSE>
<INPUT TYPE="Checkbox" NAME="ActiveYN">
</CFIF>
</td>
</tr>
</cfoutput>
</table>
<br>
<INPUT TYPE="Submit" name="Submit" title="Submit Update">
</cfform>
<br>
Action Page:
<cfparam name="frmInact.ActiveYN" default="" >
<CFQUERY DATASOURCE="PET">
UPDATE ParentSchoolTbl
SET ActiveYN = '#Trim(frmInact.ActiveYN)#'
WHERE ParentID=#URL.ParentID# and Form.DistrictIDFK = #Session.DistrictIDFK#
</CFQUERY>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Hey B,
Thanks for the info. I modified it and now I don't get the error. When the ActiveYN value is initially True, unchecking the checkbox does change it to false in the table. However, when I check the ActiveYN checkbox, it doesn't change back to true. Do I need to pose this as a different question?
Thanks.
John
Thanks for the info. I modified it and now I don't get the error. When the ActiveYN value is initially True, unchecking the checkbox does change it to false in the table. However, when I check the ActiveYN checkbox, it doesn't change back to true. Do I need to pose this as a different question?
Thanks.
John
Yes, Please pose a different question, also just for debugging purpose, just on your action page have <cfdump var ="#form#" />, this would give you a better idea of WHAT form values are passed and how they look, FORM would be a struct.
Also, you can modify the above checking code to
<CFINPUT TYPE="Checkbox" NAME="ActiveYN" <cfif ActiveYN IS "True"> checked="yes" </cfif> >
.
Check on what does FORM variable for ActiveYN pass to you when checked, intially you are setting it to
<CFSET ActiveYN="#GetParent.Activ eYN#">
but when the form is submitted it becaomes form checkbox variable. If you dump the #form# on you action page, you can see it. You would have to change <cfif ActiveYN IS "True"> condition.
Also, you can modify the above checking code to
<CFINPUT TYPE="Checkbox" NAME="ActiveYN" <cfif ActiveYN IS "True"> checked="yes" </cfif> >
.
Check on what does FORM variable for ActiveYN pass to you when checked, intially you are setting it to
<CFSET ActiveYN="#GetParent.Activ
but when the form is submitted it becaomes form checkbox variable. If you dump the #form# on you action page, you can see it. You would have to change <cfif ActiveYN IS "True"> condition.
<cfinsert
dataSource = "data source name"
tableName = "table name"
formFields = "formfield1, formfield2, ..."