Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Please Help! UPDATE QUERY WON'T WORK!

Status
Not open for further replies.

ashw

MIS
Jun 10, 2002
61
CA
Hi,
I have developed a webpage weblinks.cfm which shows the weblinks added by the users fron another page NewWeblink.cfm. On weblinks.cfm page the name of the weblink is a link which when clicked goes to the ViewEditWeblink.cfm. Here we can edit the data and click submit to go to EditWeblink.cfm page where I have written the following query to update the table in the database :

<cfquery datasource=&quot;weblink&quot; dbtype=&quot;ODBC&quot;>
Update tblweblink
SET weblinkName='#Trim(FORM.weblinkname)#',
weblinkAddress='#Trim(FORM.weblinkaddress)#',
weblinkDescription='#Trim(FORM.weblinkdescription)#',
weblinkDepartment='#Trim(FORM.weblinkdepartment)#',
weblinkAuthor='#Trim(FORM.weblinkauthor)#',
WHERE weblinkID=#FORM.weblinkID#
</cfquery>

However when I update, it shows the following error,

An error occurred while evaluating the expression:
#Trim(FORM.weblinkname)#
Error near line 12, column 19.

Error resolving parameter FORM.WEBLINKNAME
The specified form field cannot be found. This problem is very likely due to the fact that you have misspelled the form field name.
The error occurred while processing an element with a general identifier of (#Trim(FORM.weblinkname)#), occupying document position (12:18) to (12:41).

 
ashw, is vieweditweblink.cfm doing an actual form POST to editweblink.cfm? The error suggests that it isn't. You don't have any redirects or CFLOCATIONS hidden somewhere, do you?
 
Yeah, the vieeditweblink.cfm is directed to editweblinksubmit.cfm Let me show u the codes
(ViewEditWeblink.cfm code):
<!---CF Form Action (submits to Editweblinksubmit.cfm)--->
<cfform action=&quot;Editweblinksubmit.cfm&quot; name=&quot;vieweditweblink&quot; method=&quot;POST&quot;
enctype=&quot;multipart/form-data&quot; onsubmit=&quot;return validate(vieweditweblink)&quot;>

<body>
<table>
<th colspan=&quot;2&quot;>View Edit Web Link</th>
<tr>
<td>Site Name</td>
<td>
<cfoutput query=&quot;web&quot;>
<input type=&quot;hidden&quot; name=&quot;weblinkID&quot; value=&quot;#weblinkID#&quot;>
<cfinput type=&quot;text&quot; name=&quot;weblinkName&quot; Value=&quot;#weblinkName#&quot;
MESSAGE=&quot;Website Name is required!&quot; REQUIRED=&quot;Yes&quot;>
</td>
</tr>
<tr>
<td>Site Address</td>
<td>
<cfinput type=&quot;text&quot; name=&quot;weblinkaddress&quot; Value=&quot;#weblinkaddress#&quot;
MESSAGE=&quot;Website Address is required!&quot; REQUIRED=&quot;Yes&quot;> i.e. </td>
</tr>
<tr>
<td>Department</td>
<td>
<cfselect name=&quot;weblinkdepartment&quot; Value=&quot;#weblinkdepartment#&quot;
MESSAGE=&quot;Department is required!&quot; required=&quot;yes&quot;>
<!---CF Department Search Output--->
<option value=&quot;&quot;>#weblinkdepartment#</option>
<cfLoop query=&quot;departmentsearch&quot;>
<option value=&quot;#dept#&quot;>#dept#</option>
</cfLoop>
</cfselect>
</td>
</tr>
<tr>
<td>Description</td>
<td>
<textarea name=&quot;weblinkdescription&quot; rows=&quot;6&quot; cols=&quot;60&quot;>#weblinkdescription#</textarea>

</td>
</tr>
<tr>
<td>Author</td>
<td>
<cfinput type=&quot;text&quot; name=&quot;weblinkauthor&quot; Value=&quot;#weblinkauthor#&quot;
MESSAGE=&quot;Author Field is required!&quot; REQUIRED=&quot;Yes&quot;>
</td>
</tr>
<tr>
<td>&nbsp; </td>
<td>
<input type=&quot;submit&quot; value=&quot;Submit&quot;>
<input type=&quot;button&quot; name=&quot;Button&quot; value=&quot;Cancel&quot; onClick=&quot;MM_goToURL('parent','Weblinks.cfm');return document.MM_returnValue&quot;>

</td>
</tr>
</table>
</body>
</cfoutput>
</cfform>


(EditWeblinksubmit.cfm code)
<!---CF Query To Update Weblink in TblWeblink --->
<cfquery datasource=&quot;weblink&quot; dbtype=&quot;ODBC&quot;>
Update tblweblink
SET weblinkName='#Trim(FORM.weblinkname)#',
weblinkAddress='#Trim(FORM.weblinkaddress)#',
weblinkDescription='#Trim(FORM.weblinkdescription)#',
weblinkDepartment='#Trim(FORM.weblinkdepartment)#',
weblinkAuthor='#Trim(FORM.weblinkauthor)#',
WHERE weblinkID=#FORM.weblinkID#
</cfquery>
<CFLOCATION url=&quot;weblink.cfm&quot;>
</body>
 
ashw, the form tag has to be within the BODY tag for the form to parse properly.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top