ColdFusion Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreColdFusion Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old February 24th, 2006, 12:39 PM
Amudha212 Amudha212 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2006
Location: nyc
Posts: 56 Amudha212 Negative: is most likely a SPAMMER and a traitor to the cause. 
Time spent in forums: 1 Day 38 m 41 sec
Reputation Power: 0
Error says "Variable OPTION is undefined"

Hi,
I am getting the error like "Variable OPTION is undefined"

But i have defined OPTION in the previous form.

In a nutshell, i am using updating and deleting sql statements in one template, for that I use OPTION.

If i don't use the option, it works fine. But it takes the detele statement defaulty. So, please help me out from this.

Thank you!
Amudha.

Reply With Quote
  #2  
Old February 24th, 2006, 02:17 PM
kiteless kiteless is offline
Moderator
Dev Shed Expert (3500 - 3999 posts)
 
Join Date: Jun 2002
Location: Raleigh, NC
Posts: 3,742 kiteless User rank is Second Lieutenant (5000 - 10000 Reputation Level)kiteless User rank is Second Lieutenant (5000 - 10000 Reputation Level)kiteless User rank is Second Lieutenant (5000 - 10000 Reputation Level)kiteless User rank is Second Lieutenant (5000 - 10000 Reputation Level)kiteless User rank is Second Lieutenant (5000 - 10000 Reputation Level)kiteless User rank is Second Lieutenant (5000 - 10000 Reputation Level)kiteless User rank is Second Lieutenant (5000 - 10000 Reputation Level) 
Time spent in forums: 1 Week 4 Days 20 h 59 m 14 sec
Reputation Power: 62
On your action page, do:

<cfdump var="#form#"><cfabort>

and then run the code. This will dump everything in the form scope to the screen. Do you see the variable you are expecting? If not then something is wrong with your form.
__________________
Ask if you have a question, but also help answer questions that you have knowledge of! Thanks, Brian.
How to Post a Question in the Forums

Reply With Quote
  #3  
Old February 24th, 2006, 02:31 PM
Amudha212 Amudha212 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2006
Location: nyc
Posts: 56 Amudha212 Negative: is most likely a SPAMMER and a traitor to the cause. 
Time spent in forums: 1 Day 38 m 41 sec
Reputation Power: 0
Thank you for your reply!

It dumps for every page.. not for my particular page that i wanted to do.

If i don't use OPTION, it works fine. But it takes the delete statement defaultly.

I could understand that the problem would be from my SET OPTION only..

Will you help me out from this!

Amudha.


Quote:
Originally Posted by kiteless
On your action page, do:

<cfdump var="#form#"><cfabort>

and then run the code. This will dump everything in the form scope to the screen. Do you see the variable you are expecting? If not then something is wrong with your form.

Reply With Quote
  #4  
Old February 24th, 2006, 02:39 PM
kiteless kiteless is offline
Moderator
Dev Shed Expert (3500 - 3999 posts)
 
Join Date: Jun 2002
Location: Raleigh, NC
Posts: 3,742 kiteless User rank is Second Lieutenant (5000 - 10000 Reputation Level)kiteless User rank is Second Lieutenant (5000 - 10000 Reputation Level)kiteless User rank is Second Lieutenant (5000 - 10000 Reputation Level)kiteless User rank is Second Lieutenant (5000 - 10000 Reputation Level)kiteless User rank is Second Lieutenant (5000 - 10000 Reputation Level)kiteless User rank is Second Lieutenant (5000 - 10000 Reputation Level)kiteless User rank is Second Lieutenant (5000 - 10000 Reputation Level) 
Time spent in forums: 1 Week 4 Days 20 h 59 m 14 sec
Reputation Power: 62
Post your form code and the action page that the form posts to.

Reply With Quote
  #5  
Old February 24th, 2006, 02:52 PM
Amudha212 Amudha212 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2006
Location: nyc
Posts: 56 Amudha212 Negative: is most likely a SPAMMER and a traitor to the cause. 
Time spent in forums: 1 Day 38 m 41 sec
Reputation Power: 0
It has many templates in my form..

I have the problem from this point.. My code is..


cfif IsDefined("Form.btnupdate")>
<cfset Option = "UPD">

<cfelseif IsDefined("Form.btndelete")>
<cfset Option = "DEL">
</cfif>

<cfif OPTION IS ("UPD")>
<cfquery name="UPD" datasource="pm">
select * from con where concusid = '#Ncusid#' and conid= '#Nconid#'
</cfquery>

<cfoutput query="UPD">

<form action="update_action.cfm" method="post">

<table>
<tr>
<td>ConcusId :</td>
<td><input type="text" name="concusid" value ="#Ncusid#" READONLY> </td>
</tr>

<tr>
<td>ConId :</td>
<td><input type="text" name="conid" value ="#Nconid#" READONLY></td>
</tr>

<tr>
<td>Name :</td>
<td><input type="text" name="name" value =#upd.connam# ></td>
</tr>

<tr>
<td>Position :</td>
<td><input type="text" name="position" value = #upd.conpos#></td>
</tr>

<tr>
<td>Department:</td>
<td><input type="text" name="condep" value = #upd.condep#></td>
</tr>

<tr>
<td>Phone :</td>
<td><input type="text" name="phone" value = #upd.conphn#></td>
</tr>

<tr>
<td>Extension :</td>
<td><input type="text" name="extension" value = #upd.conext#></td>
</tr>

<tr>
<td>Email :</td>
<td><input type="text" name="email" value = #upd.coneml#></td>
</tr>

<tr>
<td>Email2 :</td>
<td><input type="text" name="email2" value =#upd.coneml2#></td>
</tr>

<tr>
<td>Fax :</td>
<td><input type="text" name="fax" value = #upd.confax#></td>
</tr>

<tr>
<td><input type="Submit" value="Update">
<input type="reset" value="clear Form"></td>
<tr>

<tr>
<td><input type ="Submit" value="Delete">
<tr>

</table>

</cfoutput>
</form>



AND MY ACTION PAGE CODE IS :
<CFIF OPTION IS ("UPD")>

<cfquery name="updatecontact" datasource="pm"

sql= "update con
set
connam ='#form.name#',
conpos='#form.position#',
condep='#form.condep#',
conphn='#form.phone#',
conext='#form.extension#',
coneml='#form.email#',
coneml2='#form.email2#',
confax='#form.fax#'
where concusid = '#form.concusid#'
and conid = '#form.conid#'">
</CFIF>

<CFIF OPTION IS ("DEL")>

<cfquery name = "deletecontact" datasource="pm"
sql ="delete from con where concusid = '#form.concusid#' and conid = '#form.conid#'">
</CFIF>

<cfinclude template="info.cfm">



Quote:
Originally Posted by kiteless
Post your form code and the action page that the form posts to.

Reply With Quote
  #6  
Old February 24th, 2006, 03:45 PM
Amudha212 Amudha212 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2006
Location: nyc
Posts: 56 Amudha212 Negative: is most likely a SPAMMER and a traitor to the cause. 
Time spent in forums: 1 Day 38 m 41 sec
Reputation Power: 0
THE MAIN FORM CODE IS:

<cfif Not Isdefined("Ncusid")><cfset #Ncusid# = ""></cfif>

<cfset set1 = "select * from cus">

<cfset set2="select cus.cusid, cus.cusnam, cus.cusadd, cus.cusadd1, cus.cuscty, cus.cusstt, cus.cuscny, cus.cusphn, cus.cusphn1, cus.cusfax, cus.cuswww,con.conid, con.concusid, con.connam, con.conpos,con.condep, con.conphn, con.conext, con.coneml, con.coneml2, con.confax from con, cus where con.concusid = cus.cusid and cus.cusid='#Ncusid#'">

<cfset set3 = "select * from cus where cusid='#Ncusid#'">

<cfquery name="getset1" datasource="pm">#PreserveSingleQuotes(set1)#</cfquery>

<cfquery name="getset2" datasource="pm">#PreserveSingleQuotes(set2)#</cfquery>

<cfquery name="getset3" datasource="pm">#PreserveSingleQuotes(set3)#</cfquery>

<html>
<title>
Contact information page
</title>

<h2> Contact Information </h2>

<form action="goandnew.cfm" method="post">

Customer :
<select name="Ncusid">
<cfoutput><option value <cfif #Ncusid# is ""> selected </cfif> > Select a

Customer </option> </cfoutput>
<cfoutput query ="getset1">
<option value=#GETset1.cusid# <cfif #GETset1.cusid# is #Ncusid#> selected

</cfif> > #cusnam# </option>
</cfoutput>
</select>

<input type="submit" name="btngo" value="go">
<br> <br>
<input type="submit" name="btnadd" value= "New Contact">

</form>

<br><br>

<cfoutput>
<table>
<tr><td>Location :</td> <td> #getset3.cuscty# </td> </tr>
<tr><td>Phone :</td><td> #getset3.cusphn# </td> </tr>
<tr><td>Fax :</td><td> #getset3.cusfax# </td> </tr>
<tr><td>Web :</td><td> #getset3.cuswww# </td> </tr>
</table>
</cfoutput>

<table cellpadding="15" cellspacing="0" border="1">
<tr>
<th>connam</th>
<th>condep</th>
<th>conphn</th>
<th>conext</th>
<th>coneml</th>
</tr>

<cfoutput query="getset2">
<form action = "updatecontact.cfm" method="post">
<tr>
<td>#connam#</td>
<td>#condep#</td>
<td>#conphn#</td>
<td>#conext#</td>
<td>#coneml#</td>
<input type="hidden" name="Ncusid" value= "#cusid#">
<input type="hidden" name="Nconid" value= "#conid#">
<td><input type="submit" name="btnupdate" value="update"></td>
<td><input type="submit" name="btndelete" value="delete"></td>
</form>
</tr>

</cfoutput>
</table>
<cfdump var="#form#"><cfabort>
</html>




Quote:
Originally Posted by kiteless
Post your form code and the action page that the form posts to.

Reply With Quote
  #7  
Old February 24th, 2006, 03:58 PM
Tukaro's Avatar
Tukaro Tukaro is offline
Standing 3 feet to the left.
Dev Shed Beginner (1000 - 1499 posts)
 
Join Date: Jan 2006
Location: USA
Posts: 1,066 Tukaro User rank is First Lieutenant (10000 - 20000 Reputation Level)Tukaro User rank is First Lieutenant (10000 - 20000 Reputation Level)Tukaro User rank is First Lieutenant (10000 - 20000 Reputation Level)Tukaro User rank is First Lieutenant (10000 - 20000 Reputation Level)Tukaro User rank is First Lieutenant (10000 - 20000 Reputation Level)Tukaro User rank is First Lieutenant (10000 - 20000 Reputation Level)Tukaro User rank is First Lieutenant (10000 - 20000 Reputation Level)Tukaro User rank is First Lieutenant (10000 - 20000 Reputation Level) 
Time spent in forums: 1 Week 2 Days 19 h 54 m 13 sec
Reputation Power: 104
Send a message via AIM to Tukaro Send a message via MSN to Tukaro
Is all the code from one cfm page, or multiple ones?

Also, which line is the error from? You have a lot of lines that use Option...

If they are on different pages, or the Action Page code is seperated from the first set of code you posted (i.e., the first set is in a <cfif>, the second set is in a <cfelse> for that <cfif>), then the Action Page isn't getting the Option variable (assuming that's where the problem lies.)

If that is the case, declaring the option variable either outside the <cfif> or as a session variable (depending on circumstances) could fix the problem.

Reply With Quote
  #8  
Old February 24th, 2006, 04:04 PM
Amudha212 Amudha212 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2006
Location: nyc
Posts: 56 Amudha212 Negative: is most likely a SPAMMER and a traitor to the cause. 
Time spent in forums: 1 Day 38 m 41 sec
Reputation Power: 0
YEP! you got it.. (from my first coding post!)

I have another option like that for GO AND SEARCH..

I want UPDATE(UPD) and DELETE (DEL) in the same page to use this OPTION METHOD...

That's why problem begins...

I am still working on this OPTION.. but no positive result!!

Quote:
Originally Posted by Tukaro
Is all the code from one cfm page, or multiple ones?

Also, which line is the error from? You have a lot of lines that use Option...

If they are on different pages, or the Action Page code is seperated from the first set of code you posted (i.e., the first set is in a <cfif>, the second set is in a <cfelse> for that <cfif>), then the Action Page isn't getting the Option variable (assuming that's where the problem lies.)

If that is the case, declaring the option variable either outside the <cfif> or as a session variable (depending on circumstances) could fix the problem.

Reply With Quote
  #9  
Old February 24th, 2006, 05:08 PM
kiteless kiteless is offline
Moderator
Dev Shed Expert (3500 - 3999 posts)
 
Join Date: Jun 2002
Location: Raleigh, NC
Posts: 3,742 kiteless User rank is Second Lieutenant (5000 - 10000 Reputation Level)kiteless User rank is Second Lieutenant (5000 - 10000 Reputation Level)kiteless User rank is Second Lieutenant (5000 - 10000 Reputation Level)kiteless User rank is Second Lieutenant (5000 - 10000 Reputation Level)kiteless User rank is Second Lieutenant (5000 - 10000 Reputation Level)kiteless User rank is Second Lieutenant (5000 - 10000 Reputation Level)kiteless User rank is Second Lieutenant (5000 - 10000 Reputation Level) 
Time spent in forums: 1 Week 4 Days 20 h 59 m 14 sec
Reputation Power: 62
OK I'm afraid I opened a can of worms. I don't have time to look at the code in detail becuase to be honest there is simply too much there and what is there is too confusing.

My advice would be to refactor your entire approach because this is just way too convoluted. Trying to maintain this going forward will be a nightmare.

Can you describe as briefly as you can exactly what you are trying to do? Maybe we can talk through a better approach.

Reply With Quote
  #10  
Old February 24th, 2006, 07:43 PM
Amudha212 Amudha212 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2006
Location: nyc
Posts: 56 Amudha212 Negative: is most likely a SPAMMER and a traitor to the cause. 
Time spent in forums: 1 Day 38 m 41 sec
Reputation Power: 0
In my form, everything works fine. But for one! that is,

I am trying to do two action page's sql statements in one template with use of CFIF OPTION that's it.

Thanks kateless!

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreColdFusion Development > Error says "Variable OPTION is undefined"


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support |