Ask a Question related to Coldfusion - Advanced Techniques, Design and Development.
-
vijay_wv #1
dynamic select names
Hi,
need help to write action page respective to the dynamic select names and
values from the database as shown below. I know how to write code if the select
box has name not pulling from the database but in my case names are also
pulling from the database and I have no clue how to write action page for this.
For example: (if the select box name is just "ServerModel" then i know how to
write an action page)
<cfif #len(LTrim(form.ServerModel))# GT 0>
<cfquery name="getHwCost" datasource="isdMRRequest">
SELECT EstUnitPrice FROM ServerHardware
WHERE HdwrItemID = '#form.ServerModel#'
</cfquery>
<cfquery name="insertServerItems" datasource="isdMRRequest">
INSERT INTO ServerReqDetail
(ServerRequestNo,ItemID,UnitPrice,ServerReqIndex,H ardOrSoft)
VALUES(#RequestNo#,'#form.ServerModel#','#getHwCos t.EstUnitPrice#',#Index#,'H')
</cfquery>
</cfif>
Here is my case (code shown below)
Here is the formpage.cfm:
<cfquery name="categorytest" datasource="isdMRRequest">
Select * from ServerCategories WHERE RetireDate IS NULL AND Appear = 1 AND
Type = 'H' ORDER BY CategoryID
</cfquery>
<cfloop query="categorytest">
<cfset TMP2 = #Category#><tr><td align="left">
<cfoutput query="categorytest" maxrows="1">
#TMP2#:<br>
</cfoutput><cfset TMP = #CategoryID#></td><td align="left">
<select name="#categorytest.Category#">
<option value="">Select</option>
<cfoutput query="getHardwareItems">
<cfif #CategoryID# EQ #TMP#>
<option value="#HdwrItemID#">#Description# #DollarFormat(EstUnitPrice)#
</option>
</cfif>
</cfoutput>
<cfif #categorytest.qty# EQ 1>
<input type="hidden" type="text" name="dummy" size="1"> Qty:
<input type="text" name="<cfoutput>#categorytest.Category#Qty</cfoutput>"
size="1">
</cfif>
<cfif #categorytest.Repeat# GTE 2>
<tr>
<td></td>
<td nowrap><select name="#categorytest.Category#2">
<option value="">Select</option>
<cfoutput query="getHardwareItems">
<cfif #CategoryID# EQ #TMP#>
<option value="#HdwrItemID#">#Description# #DollarFormat(EstUnitPrice)#
</option>
</cfif>
</cfoutput>
</select>
<cfif #categorytest.qty# EQ 1>
<input type="hidden" type="text" name="dummy" size="1"> Qty:
<input type="text" name="<cfoutput>#categorytest.Category#Qty2</cfoutput>"
size="1">
</cfif> </td>
</tr>
</cfif>
<cfif #categorytest.Repeat# GTE 3>
<tr>
<td></td>
<td nowrap><select name="#categorytest.Category#3">
<option value="">Select</option>
<cfoutput query="getHardwareItems">
<cfif #CategoryID# EQ #TMP#>
<option value="#HdwrItemID#">#Description# #DollarFormat(EstUnitPrice)#
</option>
</cfif>
</cfoutput>
</select>
<cfif #categorytest.qty# EQ 1>
<input type="hidden" type="text" name="dummy" size="1"> Qty:
<input type="text" name="<cfoutput>#categorytest.Category#Qty3</cfoutput>"
size="1">
</cfif> </td>
</tr>
</cfif>
Please help me in creating an action page for the code shown above...Thanks a
lot in advance.
vijay_wv Guest
-
Cold Fusion Dynamic field names
Hello, thanks for reading... what I'm trying to do is below and it works... <cfquery name="updateans" datasource="database"> UPDATE... -
Select answer Without field names
how can i get an answer from a select query without the column names first ? i can't understant how to use the option --skip-column-names ... ... -
disable dynamic (?) file names?
I just reinstalled Macromedia MX and a CF testing server on a new computer. I see these type of file names showing up again: TMPon24wqqrss.htm. I... -
Dynamic variable names??? Please Help!
So I'm making this application for accessing research data - lots of different data tables, each with it's own data columns. I have made the... -
Dynamic Variable Names
I have a shopping cart page that allows a user to type in a new quantity and press a button. The quantities entered are in form text boxes with... -
BSterner #2
Re: dynamic select names
Can you clarify in more detail what you're trying to do w/this form. What do
you mean by "I know how to write code if the select box has name not pulling
from the database"? Looks like you're not outputting a select box if the value
isn't in the database?
BSterner Guest
-
jorgepino #3
Re: dynamic select names
not entirely sure what you trying to accomplish
can you give me some more info
post code make sure to use the "attache Code " feature
jorgepino Guest



Reply With Quote

