SunQuest
           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:
Get inside! Sample the range of functionality easily built with JMSL Library for Time Series Data Analysis, Heat Maps, Portfolio Optimization, Monte Carlo Simulation, Stock Price Charting and more. Download Now!
  #1  
Old October 13th, 2004, 04:00 PM
webtress webtress is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2004
Posts: 5 webtress User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Passing autonumber using <SELECT>

Stupid question....

I think I'm having a mental meltdown or something cause I know I've done this before, but for the life of me I am at a brick wall!

I have a form (form1.cfm) that uses a <select> box pre-filled via DB that a user chooses to get details on. I have set the <option value="#record_id#"> and have the form passing id on url, but will only pull up the first Record ID no matter which one I choose? I am using a cfoutput.

What the heck have I missed in order to get each rec_id to pass with the chosen record?????

PLEASE HELP!

Reply With Quote
  #2  
Old October 13th, 2004, 04:53 PM
bocmaxima's Avatar
bocmaxima bocmaxima is offline
Contributing User
Dev Shed Beginner (1000 - 1499 posts)
 
Join Date: Aug 2004
Location: Tucson, Sonora
Posts: 1,322 bocmaxima User rank is Sergeant (500 - 2000 Reputation Level)bocmaxima User rank is Sergeant (500 - 2000 Reputation Level)bocmaxima User rank is Sergeant (500 - 2000 Reputation Level)bocmaxima User rank is Sergeant (500 - 2000 Reputation Level)bocmaxima User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 3 Days 17 h 46 m 5 sec
Reputation Power: 22
Send a message via AIM to bocmaxima
Look at your HTML output source and make sure that the values for the options are unique.
If they are, then post some of your code, especially for whatever you're posting the form to.

Reply With Quote
  #3  
Old October 13th, 2004, 06:23 PM
kiteless kiteless is offline
Moderator
Dev Shed Expert (3500 - 3999 posts)
 
Join Date: Jun 2002
Location: Raleigh, NC
Posts: 3,626 kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 1 Week 4 Days 10 h 6 m 34 sec
Reputation Power: 53
You're probably not looping over the query and populating the select box correctly.
__________________
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
  #4  
Old October 13th, 2004, 07:09 PM
webtress webtress is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2004
Posts: 5 webtress User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Select box ok

The select box is populating fine. It is when the form posts that I can only get the first record id value even if I choose record 83 in the select box. I am not using a CFLOOP. Here is the code I have currently:

<CFQUERY NAME="phone_byname" DATASOURCE="innet">
Select phone_fname, phone_lname, phone_id, fax_switch
From phone_fax
Where phone_lname IS NOT NULL AND phone_fname IS NOT NULL
Order By phone_lname ASC
</CFQUERY>

<FORM ACTION="phone.cfm?action=phlkup&phone_id=<CFOUTPUT>#phone_id#</CFOUTPUT>" METHOD="post">

<INPUT TYPE="Hidden" NAME="phone_id" VALUE="#phone_id#">
<INPUT TYPE="Hidden" NAME="fax_switch" VALUE="#fax_switch#">
<INPUT TYPE="Hidden" NAME="phone_lname" VALUE="#phone_lname#">
<INPUT TYPE="Hidden" NAME="phone_fname" VALUE="#phone_fname#">

<B>Search by Name:</B><BR>

<SELECT NAME="phone_selectname" SIZE="1">
<OPTION SELECTED VALUE="0">Choose Name</OPTION>
<OPTION VALUE="all">All</OPTION>
<CFOUTPUT QUERY="phone_byname">
<OPTION VALUE="#phone_id#"> #phone_fname# #phone_lname#</OPTION>
</CFOUTPUT>
</SELECT><INPUT TYPE="Submit" VALUE="Find">
</FORM>

After a record is chosen, say record 43, the form redirects and on the url is ALWAYS phone_id=1. The data outputs for record id 1.

I just don't know why the heck I cannot pass phone_id #anything-but-1#???

Reply With Quote
  #5  
Old October 13th, 2004, 10:11 PM
kiteless kiteless is offline
Moderator
Dev Shed Expert (3500 - 3999 posts)
 
Join Date: Jun 2002
Location: Raleigh, NC
Posts: 3,626 kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 1 Week 4 Days 10 h 6 m 34 sec
Reputation Power: 53
Given the code you have written, how can it be anything except 1? Look at what you are doing:

<FORM ACTION="phone.cfm?action=phlkup&phone_id=<CFOUTPUT>#phone_id#</CFOUTPUT>" METHOD="post">

This will always pass the first record in the recordset in the URL. The user isn't picking anything. What you want to do is remove the phone_id URL variable and let the user pick it in the form, which will pass the phone_id as a FORM field. You should not be passing this in the form action's URL if you want the user to pick it in the form.

Reply With Quote
  #6  
Old October 13th, 2004, 11:07 PM
webtress webtress is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2004
Posts: 5 webtress User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Unhappy passing form variable

Quote:
What you want to do is remove the phone_id URL variable and let the user pick it in the form, which will pass the phone_id as a FORM field. You should not be passing this in the form action's URL if you want the user to pick it in the form.


I tried that originally. I even left the hidden form field for phone_id (autonumber). That's why I said I knew this should be a simple thing, but I am baffled why it is ending up a major process. I include it on the recieving template in the query as:
<cfif action IS "phlkup">
<CFQUERY NAME="phone_choice" DATASOURCE="innet">
Select phone_fname, phone_lname, dept, phone_ext, phone_id, fax_switch
From phone_fax
Where phone_id = #form.phone_id#

This is the error I get:

ODBC Error Code = 37000 (Syntax error or access violation)


[Microsoft][ODBC Microsoft Access Driver] Syntax error in date in query expression 'phone_id = #phone_id#'.


SQL = "Select phone_fname, phone_lname, dept, phone_ext, phone_id, fax_switch From phone_fax Where phone_id = #phone_id#"

Notice that it states error in DATE ????? It is an autonumber?? Nothing refers to date format anywhere. Also note that this does not show the actual coding of #form.phone_id#????

Not only this, but I have included the following as the first thing on the page:

<CFIF #IsDefined("url.action")#>
<cfset action = "phlkup">
<cfoutput>phone_id: #form.phone_id#</cfoutput>
</CFIF>

Nothing comes up for form.phone_id???? It is blank.....

Reply With Quote
  #7  
Old October 13th, 2004, 11:54 PM
webtress webtress is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2004
Posts: 5 webtress User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Lightbulb Got It!!!

I just KNEW it was something stupid! I was asking for form.phone_id, but that was the VALUE of the select field so I really needed form.phone_selectname which is where the phone_id values were held!

where phone_id = #form.phone_selectname#

DUH!

I can finally sleep!!

Thanks for all the help and insight. I am really glad I happened on this site today because I have posted issues in the past at other places and never received a response of any kind. Thanks for your blatant honesty kiteless...(how can it be anything except 1?) I knew this, but couldn't see what I was doing until you wrote it. I'll be baaaackk!

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreColdFusion Development > Passing autonumber using <SELECT>


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 | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway