Skip to main content
Participating Frequently
January 2, 2010
Answered

Element EMP_ID is undefined URL error?

  • January 2, 2010
  • 3 replies
  • 2271 views

I was trying out the exercises on doing CF Update using the same example posted in the Adobe website:

http://help.adobe.com/en_US/ColdFusion/9.0/Developing/WSc3ff6d0ea77859461172e0811cbec0e02b-7ff3.html

But everytime I run the page I get an error "Element EMP_ID is undefined in URL.

line 9: WHERE Emp_ID = #URL.Emp_ID#

What does it mean? and how can I fix it?

This topic has been closed for replies.
Correct answer yui8979

how are you running the page? You need to pass in emp_id=12345 in the URL if

you haven't already :

http://www.goto.com/yourcfmexamplepage.cfm?emp_id=12345

"Error Element EMP_ID is undefined in URL" means that the Coldfusion server

cannot find the EMP_ID defined anywhere in the URL scope, which is what

you're asking Coldfusion to do when you put #URL.Emp_ID#.

3 replies

BKBK
Community Expert
Community Expert
January 4, 2010

I was trying out the exercises on doing CF Update using the same example posted in the Adobe website:

http://help.adobe.com/en_US/ColdFusion/9.0/Developing/WSc3ff6d0ea77859461172e081 1cbec0e02b-7ff3.html

But everytime I run the page I get an error "Element EMP_ID is undefined in URL.

line 9: WHERE Emp_ID = #URL.Emp_ID#

What does it mean? and how can I fix it?

Run a test page containing  the following code:

<cfquery name="GetRecordtoUpdate" datasource="cfdocexamples">
    SELECT * FROM Employee   
</cfquery>
<cfdump var="#GetRecordtoUpdate#">

You will find that the table has emp_id values 1,2,3,5,6,7,8,9,11,15, .... So, let's say your action page for the form in that example is called updateForm.cfm. Then, you should pass the value url.emp_id=8 like this

http://127.0.0.1:8500/updateForm.cfm?emp_id=8

Inspiring
January 2, 2010

But everytime I run the page I get an error "Element EMP_ID is undefined in URL.

line 9: WHERE Emp_ID = #URL.Emp_ID#

What does it mean? and how can I fix it?

Ask yourself this question: "What is a URL?"  Then this question: "In regards to the URL... what could 'Element EMP_ID is undefined' mean?"


Also, did you read the instructions that go with that code on that page you cited?  Esp. item 3.

--

Adam

yui8979Correct answer
Inspiring
January 2, 2010

how are you running the page? You need to pass in emp_id=12345 in the URL if

you haven't already :

http://www.goto.com/yourcfmexamplepage.cfm?emp_id=12345

"Error Element EMP_ID is undefined in URL" means that the Coldfusion server

cannot find the EMP_ID defined anywhere in the URL scope, which is what

you're asking Coldfusion to do when you put #URL.Emp_ID#.

Participating Frequently
January 2, 2010

i copied/paste the exact same code from the sample.. was just testing out how it work out.. but i guess im getting this error page

Inspiring
January 2, 2010

You found out how it works then.  You can't use variables that don't exist.

If you want to see how the page works, change this:

SELECT * FROM Employee 
WHERE Emp_ID = #URL.Emp_ID#

to this

SELECT * FROM Employee 
WHERE Emp_ID = a number that exists in your database.