|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
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
|
|||
|
|||
|
select box problems
I can't get this select box to be pre-populated with the values already in the database!
code -------------------- grabs all data where taskid is 62 and grouprole is 4<br><cfdump var="#getTaskInfo#"><p></p><cfset i = 1><cfoutput query="getTaskInfo">#i# - <select name="#i#"><cfloop query="getGroups"><option value="#GroupID#" <cfif getTaskInfo.GroupID is getGroups.GroupID>SELECTED</cfif>>#GroupName#</option></cfloop></select><br><cfset i = i + 1></cfoutput> ----------------- the result i need is select box 1 contain the value Information Security 2 should equal IVR/Common Components 3 should be Engineering 4 should be Distributed Systems any help would be great...thanks a lot! |
|
#2
|
|||
|
|||
|
I'm confused, because given your query result set, you're saying that you want only one element in each of the four drop down boxes...what's the point in that?
If the result set is going to get bigger, the easiest solution would be to simply run four queries, one for each select box.
__________________
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 |
|
#3
|
|||
|
|||
|
sorry for not explaining it better....I want the drop down boxes populated with the values in the query "getGroups", not a problem, i can do that. but the info in the query "getTaskInfo" needs to be displayed in the select boxes as pre-selected items so the users don't mess everything up when they go back to edit something.
does that make sense? |
|
#4
|
|||
|
|||
|
A little, but it's still rather unclear. So you have two queries, one populates all of the drop down lists, the second one shows that you want the default selections in each of those lists to be. Is that right?
If I'm understanding corrently (which I'm still not sure of), you can probably do something like this: Code:
<cfloop index="i" from="1" to="4">
#i# - <select name="#i#">
<cfoutput query="getTaskInfo">
<option value="#GroupID#" <cfif getTaskInfo.GroupID is getGroups.GroupID[i]> SELECTED</cfif>>
#GroupName#
</option>
</cfoutput>
</select>
<br>
</cfloop>
|
|
#5
|
|||
|
|||
|
so close!!! that sort of worked but the drop downs were only populated with the values of the "getTaskInfo" query. they should be populated with the values of the "getGroups" query.
it's hard to explain things without the pointing and hand waving...thanks for humoring me. Each Select box should be populated with the values from the "getGroups" query (all the values in the groups table) then based on the results of the "getTaskInfo" query, the correct group should be selected in the drop down based on the info in the database. i can do some more screen shots of data dumps if it will help. |
|
#6
|
|||
|
|||
|
In that case, try swapping the query names, like this:
Code:
<cfloop index="i" from="1" to="4">
#i# - <select name="#i#">
<cfoutput query="getGroups">
<option value="#GroupID#" <cfif getTaskInfo.GroupID[i] is getGroups.GroupID> SELECTED</cfif>>
#GroupName#
</option>
</cfoutput>
</select>
<br>
</cfloop>
|
|
#7
|
|||
|
|||
|
JACKPOT! Thanks for taking the time to help me through this. I owe you big time. Thanks again!
![]() |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > ColdFusion Development > select box problems |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|