1 Replies - 5067 Views - Last Post: 07 December 2008 - 09:49 AM Rate Topic: -----

#1 cumupkid  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 63
  • Joined: 22-January 08

Error "Variable CUSTOMEREDIT is undefined"

Post icon  Posted 07 December 2008 - 03:51 AM

When I update the record, it does the updat then i get an error message
"Variable CUSTOMEREDIT is undefined"

Code for page


<cfparam name="URL.Phone" default="1">
<cfparam name="URL.Zip" default="1">

	<cfinvoke 
		 component="DTCRM.cfcs.customers"
		 method="getCustomerByPhoneURL"
		 returnvariable="qCustomerByPhoneURL">
	</cfinvoke>
	
	<cfinvoke 
		 component="DTCRM.cfcs.customers"
		 method="getCityStateByZipURL"
		 returnvariable="qCityStateByZipURL">
	</cfinvoke>

<cfif isdefined("form.phone")>

 	<cfinvoke 
	 	component="DTCRM.cfcs.customers" method="customeredit">
		<cfinvokeargument name="formdata" value="#form#"/>
	</cfinvoke>

<cfset customeredit( formdata= FORM)>
<cflocation url="index.cfm?customerDetails&Phone=#form.Phone#&Zip=#form.zip#" addtoken="no">

</cfif>


<!-- pageName -->
	<table width="100%">
		<td valign="top" class="pageName"><div align="center">Edit Customer Details</div></td>
	</table>
	
<table border="0" cellspacing="0" cellpadding="0" width="100%">
		<tr>
			<td valign="bottom" colspan="" nowrap="nowrap" class="pageHeader" height="85" width="100%">
				<cfoutput> Details for #qCustomerByPhoneURL.FirstName1# #qCustomerByPhoneURL.LastName#</cfoutput>		  </td>
		</tr>
</table>

<table border="0" cellspacing="0" cellpadding="0" width="100%">
		<tr valign="bottom">
			<td height="60" colspan="7" align="center" nowrap="nowrap" id="alphaLinks"><p>
		</tr>
</table>


<cfform>

<table bgcolor="99CCFF" align="center" width="50%" border="0" id="table">

  <tr>
	<td width="25%" height="20" class="subHeader">&nbsp;</td>
	<td width="25%" height="20" class="subHeader">First Name:</td>
	<td width="50%" height="20" align=" right"><cfinput type="text" name="firstname1" id="firstname1" tabindex="1" value="#qCustomerByPhoneURL.FirstName1#" cfsqltype="cf_sql_varchar" maxlength="200"></td>
  </tr>
  <tr>
	<td width="25%" height="20" class="subHeader">&nbsp;</td>
	<td width="25%" height="20" class="subHeader">Last Name:</td>
	<td width="50%" height="20"><cfinput type="text" name="lastname" id="lastname" tabindex="2" value="#qCustomerByPhoneURL.LastName#" cfsqltype="cf_sql_varchar" maxlength="20"></td>
  </tr>
  <tr>
	<td width="25%" height="20" class="subHeader">&nbsp;</td>
	<td width="25%" height="20" class="subHeader">Email:</td>
	<td width="50%" height="20"><cfinput type="text" name="firstname2" validateat="onsubmit" validate="Email" id="firstname2" tabindex="3" value="#qCustomerByPhoneURL.FirstName2#" cfsqltype="cf_sql_varchar" maxlength="50" typeahead="no" showautosuggestloadingicon="true"></td>
  </tr>
  <tr>
	<td width="25%" height="20" class="subHeader">&nbsp;</td>
	<td width="25%" height="20" class="subHeader">Phone:</td>
	<td width="50%" height="20"><cfinput type="text" name="phone" id="phone" tabindex="4" value="#qCustomerByPhoneURL.Phone#" cfsqltype="cf_sql_varchar" maxlength="12" readonly="true" typeahead="no" showautosuggestloadingicon="true"></td>
  </tr>
  <tr>
	<td width="25%" height="20" class="subHeader">&nbsp;</td>
	<td width="25%" height="20" class="subHeader">Street:</td>
	<td width="50%" height="20"><cfinput type="text" name="add1" id="add1" tabindex="5" value="#qCustomerByPhoneURL.Add1#" cfsqltype="cf_sql_varchar" maxlength="50"></td>
  </tr>
  <tr>
	<td width="25%" height="20" class="subHeader">&nbsp;</td>
	<td width="25%" height="20" class="subHeader">City:</td>
	<td width="50%" height="20"><cfinput type="text" name="city" id="city" tabindex="6" value="#qCityStateByZipURL.City#" maxlength="20" cfsqltype="cf_sql_varchar"></td>
  </tr>
  <tr>
	<td width="25%" height="20" class="subHeader">&nbsp;</td>
	<td width="25%" height="20" class="subHeader">State:</td>
	<td width="50%" height="20">
		<cfselect name="State" id="State" tabindex="7"> 
		<cfoutput>
			  <option value="#qCityStateByZipURL.State#" selected="selected">#qCityStateByZipURL.State#</option>
		</cfoutput>
	<option value="AK">AK</option>
	<option value="AL">AL</option>
	<option value="AR">AR</option>
	<option value="AZ">AZ</option>
	<option value="CA">CA</option>
	<option value="CO">CO</option>
	<option value="CT">CT</option>
	<option value="DC">DC</option>
	<option value="DE">DE</option>
	<option value="FL">FL</option>
	<option value="GA">GA</option>
	<option value="HI">HI</option>
	<option value="IA">IA</option>
	<option value="ID">ID</option>
	<option value="IL">IL</option>
	<option value="IN">IN</option>
	<option value="KS">KS</option>
	<option value="KY">KY</option>
	<option value="LA">LA</option>
	<option value="MA">MA</option>
	<option value="MD">MD</option>
	<option value="ME">ME</option>
	<option value="MI">MI</option>
	<option value="MN">MN</option>
	<option value="MO">MO</option>
	<option value="MS">MS</option>
	<option value="MT">MT</option>
	<option value="NC">NC</option>
	<option value="ND">ND</option>
	<option value="NE">NE</option>
	<option value="NH">NH</option>
	<option value="NJ">NJ</option>
	<option value="NM">NM</option>
	<option value="NV">NV</option>
	<option value="NY">NY</option>
	<option value="OH">OH</option>
	<option value="OK">OK</option>
	<option value="OR">OR</option>
	<option value="PA">PA</option>
	<option value="PR">PR</option>
	<option value="RI">RI</option>
	<option value="SC">SC</option>
	<option value="SD">SC</option>
	<option value="TN">TN</option>
	<option value="TX">TX</option>
	<option value="UT">UT</option>
	<option value="VA">VA</option>
	<option value="VT">VT</option>
	<option value="WA">WA</option>
	<option value="WI">WI</option>
	<option value="WV">WV</option>
	<option value="WY">WY</option>
</cfselect></td>
  </tr>
  <tr>
	<td width="25%" height="20" class="subHeader">&nbsp;</td>
	<td width="25%" height="20" class="subHeader">Zip:</td>
	<td width="50%" height="20"><cfinput type="text" name="zip" validateat="onsubmit" validate="zipcode" id="zip" tabindex="8" value="#qCustomerByPhoneURL.Zip#" cfsqltype="cf_sql_varchar" maxlength="5"></td>
  </tr>
  <tr>
	<td width="25%" height="20" align="right">&nbsp;</td>
	<td width="25%" height="20" align="right"><cfinput type="submit" name="Submit" value="Submit" id="Submit"></td>
	<td width="50%" height="20"><cfinput type="button" name="cancel" id="Reset" value="Cancel" onclick="history.back()"></td>
  </tr>
</table>
</cfform>	
 


Code for CFC's


	<cffunction  name="customeredit" access="public" returntype="void">
	 	<cfargument name="formdata" required="yes"> 
		<cfquery name="customeredit" datasource="DTDatabase">
			Update customers
			set firstname1 = '#formdata.firstname1#',
				lastname = '#formdata.lastname#',
				firstname2 = '#formdata.firstname2#',
				phone = '#formdata.phone#',
				add1 = '#formdata.add1#',
				zip = '#formdata.zip#'
			where phone = '#phone#'
   		</cfquery>
	</cffunction>




Is This A Good Question/Topic? 0
  • +

Replies To: Error "Variable CUSTOMEREDIT is undefined"

#2 sansclue  Icon User is offline

  • D.I.C Regular

Reputation: 29
  • View blog
  • Posts: 316
  • Joined: 21-November 07

Re: Error "Variable CUSTOMEREDIT is undefined"

Posted 07 December 2008 - 09:49 AM

View Postcumupkid, on 7 Dec, 2008 - 02:51 AM, said:

When I update the record, it does the updat then i get an error message
"Variable CUSTOMEREDIT is undefined"

Code for page


<cfif isdefined("form.phone")>
...
<cfset customeredit( formdata= FORM)>
....
</cfif>



In short, remove the line:
<cfset customeredit( formdata= FORM)>

A) You do not need it. You've already called that function with <cfinvoke>

B ) The error message is telling you that CF doesn't know where to find the function. That is because the function is contained within a cfc. So you have to use an instance of the cfc to call it. Like you are doing here:

<cfinvoke
		 component="DTCRM.cfcs.customers" method="customeredit">
		<cfinvokeargument name="formdata" value="#form#"/>
	</cfinvoke>


This post has been edited by sansclue: 07 December 2008 - 09:50 AM

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1