Coldfusion - HTML input not getting data from HTML select option.
22 replies, posted
Confusing title, yes.
[img]http://img72.imageshack.us/img72/6026/whatx.png[/img]
Basically, I have a drop down box that displays "clubs" that have been assigned to the logged in user. In this case, it's me. I have two clubs assigned to me - "FBLA" and "James's Neat Club". When I pick "FBLA" from the drop down list, it instead gives me the name of "James's Neat Club" in the input field created below it.
I know i've coded something wrong, but i'm not sure where or how to fix it.
Here's the code:
[code]
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<link href="site.css" rel="stylesheet" type="text/css" />
</head>
<body>
<!-- If the logged in session variable exists and it equals "true" -->
<cfif structkeyexists(session, "loggedin") AND #session.loggedin# EQ 'true' >
<div id="content_holder">
<div id="header">
<div id="header_infolist">
<!-- Welcome, FirstName, LastName! -->
Welcome, <cfoutput>#session.fname# #session.lname#</cfoutput>
</div>
</div>
<div id="content">
<!-- If we see a "?return" in the URL box, AKA we submitted the form -->
<cfif structkeyexists(url, "return")>
Your changes to the club you selected have been saved.
<br />
</cfif>
Step 1: Select a club from the list below. Only clubs you have been assigned to will be available to edit.
<!-- Let's create an input form. -->
<form method="post">
<!-- On change, submit this drop down. -->
<select name="clublist" onchange="this.form.submit();">
<option value="">Please Select A Club From The List Below</option>
<!-- Get all values from the clubs table and order them by their name in A-Z order -->
<cfquery name="listclubs" datasource="lbhs">
select * from clubs order by clubname asc
</cfquery>
<!-- If the admin session variable exists and it says we're an admin -->
<cfif structkeyexists(session, "level") AND #session.level# EQ 'admin'>
<cfoutput query="listclubs">
<option value="#listclubs.id#">#listclubs.clubname#</option>
</cfoutput>
<cfelse>
<!-- Get all values from clubs_sponsors table (when you're not an admin) where the sponsor_id is equal to the session teacher ID -->
<cfquery name="listclubs_nonadmin" datasource="lbhs">
select * from clubs_sponsors where sponsor_id='#session.tid#'
</cfquery>
<cfloop query="listclubs_nonadmin">
<!-- Get all values from the clubs table where the id equals the listclubs_nonadmin club id. Order by the cclub name in ascending order -->
<cfquery name="listclubs_nonadmin_names" datasource="lbhs">
select * from clubs where id=#listclubs_nonadmin.club_id# order by clubname asc
</cfquery>
<cfoutput query="listclubs_nonadmin_names">
<option value="#listclubs_nonadmin_names.id#">#listclubs_nonadmin_names.clubname#</option>
</cfoutput>
</cfloop>
</cfif>
</select>
</form>
<cfif structkeyexists(form, 'clublist')>
<form method="post" action="submitchanges.cfm?clubid=<cfif structkeyexists(session, "level") AND #session.level# EQ 'admin'><cfoutput query="listclubs">#listclubs.id#</cfoutput><cfelse><cfoutput query="listclubs_nonadmin_names">#listclubs_nonadmin_names.id#</cfoutput></cfif>">
Club Name:<input name="clubname" type="text" value="<cfif structkeyexists(session, "level") AND #session.level# EQ 'admin'><cfoutput query="listclubs">#listclubs.clubname#</cfoutput><cfelse><cfoutput query="listclubs_nonadmin_names">#listclubs_nonadmin_names.clubname#</cfoutput></cfif>">
<input name="submit" type="submit" value="submit" />
</form>
</cfif>
</div>
</div>
</cfif>
</body>
</html>
[/code]
People still use CF?
[QUOTE=Xeon06;28100751]People still use CF?[/QUOTE]
It's what the school i'm at paid for to use for this kind of stuff.
[QUOTE=Rocket;28100858]HE'S A ROBOT!
Don't use coldfusion, there's a million and one reasons not to.
[editline]16th February 2011[/editline]
:doh:
Why do people pay for something that is harder to find developers for, has free alternatives, and...well, it's 7,500 fucking dollars.[/QUOTE]
I hate CF. It's so damn complicated to do the simplest stuff, but i'm stuck with it.
[QUOTE=Rocket;28100943]Hmmm...
Admitting that the language you are using is shit?
Touché.[/QUOTE]
Shut up, you don't know what that means.
[QUOTE=Xeon06;28138590]Shut up, you don't know what that means.[/QUOTE]
Touché?
It either means a hit, or a clever/good counterpoint in an argument.
[QUOTE=supersnail11;28138622]Touché?
It either means a hit, or a clever/good counterpoint in an argument.[/QUOTE]
Then if you know exactly what it means, why did you use it in that sentence?
[QUOTE=Xeon06;28138661]Then if you know exactly what it means, why did you use it in that sentence?[/QUOTE]
Because it was a good point / clever response?
We were saying that he shouldn't use coldfusion. He said he shouldn't either.
Wow. I'm so sorry. I should have realized there was no point to having this conversation. It won't happen again.
[QUOTE=supersnail11;28138680]Because it was a good point / clever response?
We were saying that he shouldn't use coldfusion. He said he shouldn't either.[/QUOTE]
Stop trying to be intelligible you always fail.
You barely know HTML so why post in a coldfusion thread?
[QUOTE=sebmck;28138736]Stop trying to be intelligible you always fail.
You barely know HTML so why post in a coldfusion thread?[/QUOTE]
Evidence that I barely know HTML?
[QUOTE=supersnail11;28138956]Evidence that I barely know HTML?[/QUOTE]
I can't be bothered finding the other thread when you decided to use precode tags as well as putting HTML in between the <HEAD> tags.
[QUOTE=sebmck;28139032]I can't be bothered finding the other thread when you decided to use precode tags as well as putting HTML in between the <HEAD> tags.[/QUOTE]
The pre tags were there because I had a list before and I didn't bother removing them.
And anyways, everyone makes mistakes, making one isn't evidence that I barely know HTML.
[QUOTE=supersnail11;28139100]The pre tags were there because I had a list before and I didn't bother removing them.
And anyways, everyone makes mistakes, making one isn't evidence that I barely know HTML.[/QUOTE]
Doesn't point away to the fact you should stop posting.
[QUOTE=sebmck;28139148]Doesn't point away to the fact you should stop posting.[/QUOTE]
Doesn't point away from the fact that all you people just seem to want to say everything along the lines of "You're dumb", and nothing about the points I'm making in my posts.
[QUOTE=supersnail11;28139176]Doesn't point away from the fact that all you people just seem to want to say everything along the lines of "You're dumb", and nothing about the points I'm making in my posts.[/QUOTE]
[QUOTE=Sharpshooter;28139057]
You really need to leave this section supersnail, you bring nothing, you give nothing, which means you probably are nothing.[/QUOTE]
[QUOTE=sebmck;28139217]:words: that are quotes[/QUOTE]
Thanks for proving my point?
[QUOTE=supersnail11;28139409]Thanks for proving my point?[/QUOTE]
I didn't actually. Besides why do you insist on posting when no one wants you here? If basically 90% of a forum wanted me gone. I'd leave as there'd be no point in posting.
[QUOTE=sebmck;28139430]I didn't actually. Besides why do you insist on posting when no one wants you here? If basically 90% of a forum wanted me gone. I'd leave as there'd be no point in posting.[/QUOTE]
Except when I have things such as solutions, projects to post in the WAYWO, questions?
[QUOTE=supersnail11;28139443]Except when I have things such as solutions, projects to post in the WAYWO, questions?[/QUOTE]
Do that. Ask for advice but DON'T ACT LIKE YOU KNOW THINGS YOU DON'T.
[QUOTE=supersnail11;28139443]Except when I have things such as solutions[/QUOTE]
:specialschool:
[QUOTE=supersnail11;28139443]projects to post in the WAYWO[/QUOTE]
Ahahahaha
[QUOTE=supersnail11;28139443]questions?[/QUOTE]
Even your questions are shit.
Sorry, you need to Log In to post a reply to this thread.