Ask a Question related to Coldfusion - Advanced Techniques, Design and Development.
-
jolejni #1
Passing the value of a Dynamic List
Hi all - not sure what I am missing here, however I would like to pass the
option value of my list to the desired URL within my on-change event. I can get
two out of three to pass, however I cant pass the selection made from the list.
I've included the code below, any ideas? Thank you in advance! <form
name='form' method='post' action=''> <cfif isdefined('session.arrMyFav')>
<cfloop index='idx' from='1' to='#ArrayLen(session.arrMyFav)#'>
<cfoutput> <img src='../Images/#session.arrMyFav[idx][2]#'>
<select name='Sel'
onChange='MM_goToURL('parent','Builder.cfm?Frame=< cfoutput>#URL.Frame#</cfoutputdocument.MM_returnValue'> <cfloop index='idx' from='1'>&Image=<cfoutput>#session.arrMyFav[idx][2]#</cfoutput>');return
to='#Get_Frame.Frame_Quad#'> <option value='idx'>Quad
#idx#</option> <!---This is the value that I need to pass to my builder.cfm
page----> </cfloop> </select> </cfoutput> </cfloop> </cfif> </form>
jolejni Guest
-
PASSING SELECTED OPTION VALUES FROM A LIST BOX
I have a form control called 'Nominee'. It is a list box. It is dynamically populated by | #FirstName# #MiddleName# #LastName# | retrieved from the... -
Passing Dynamic XML variables from CF Fusebox 3
Oh help and thanks in advance! I am converting a standard CF site to a Fusebox 3 site (encorporating it into Fusebox). I am using a DW Flash... -
passing dynamic variables
Am creating a video library using a database to store the url links to the videos - how do I pass a variable selection from one html page to another... -
Passing List Values
Hi, I have a long list of email addresses and I need to pass it to the next page. Say: <cfform ... action="Page1.cfm?mList=#mListVal#> When I... -
Dynamic List/Menu Passing Variables
New to Dreamweaver. Using DreamWeaverMX 6.1. I am trying to create a page that the user can select an item from a drop down menu using Dynamic... -
zoeski80 #2
Re: Passing the value of a Dynamic List
Hi
Few things I noticed in your code.
* need to have # marks around idx in the option tag eg. <option value="#idx#">
so it will get the value of the variable rather than just write out the
variable name.
* don't need CFOUTPUT's within the onChange text as the code is already within
CFOUTPUT's.
* need to have unique name for each instance of Sel output box so you can get
the data from the correct one.
* I try not to use 'form' as the form name as it would get confusing and if
there are multiple forms on page the names need to be unique. Perhaps pick a
name that describes what the form is for.
You can get access to the select box values by using
document.FormName.FieldName.value.
In attached code - check the onChange of the select boxes and you'll just need
to modify that a bit and put into your code.
Hope it helps
- Zoe
<!--- setup variables needed for code below --->
<CFSET Get_Frame.Frame_Quad = 10>
<CFSET session.arrMyFav = ArrayNew(1)>
<CFSET session.arrMyFav[1][2] = "img1.gif">
<CFSET session.arrMyFav[2][2] = "img2.gif">
<CFSET session.arrMyFav[3][2] = "img3.gif">
<CFSET session.arrMyFav[4][2] = "img4.gif">
<!--- give form a unique name --->
<form name="thisForm" method="post" action="">
<cfif isdefined("session.arrMyFav")>
<cfloop index="idx" from="1" to="#ArrayLen(session.arrMyFav)#">
<cfoutput>
#idx#:
<!--- copy value from this select box to the appropriate text box
below --->
<select name="Sel#idx#" onChange="document.thisForm.selectBox#idx#.value =
document.thisForm.Sel#idx#.value">
<cfloop index="idx" from="1" to="#Get_Frame.Frame_Quad#">
<option value="#idx#">Quad #idx#</option>
</cfloop>
</select>
<BR><BR>
</cfoutput>
</cfloop>
</cfif>
<BR><BR>
<!--- output text boxes to hold values for the select boxes above --->
<cfloop index="idx" from="1" to="#ArrayLen(session.arrMyFav)#">
<CFOUTPUT>
option selected in select box #idx#: <INPUT TYPE="text"
Name="selectBox#idx#" VALUE=""><BR>
</CFOUTPUT>
</cfloop>
</form>
zoeski80 Guest
-
jolejni #3
Re: Passing the value of a Dynamic List
Thank you so much for the reply! You really helped me out with understanding
how to use the OnChange Event. I have it all setup to pass my variables
however I can not get the selection value to pass for the life of me. I've
tried differnt syntax with no avail. Any chance you (or anyone) can tell me
what I am missing here? The IMAGE and FRAME values pass just fine, it's when I
attempt to send the selection value is when it fails (it's passing the litteral
string after the eq sign). All I want to do is set the quad variable eq to the
value of the selection and pass it as an url.variable. <cfparam
name='URL.Frame' default='1'> <cfquery name='Get_Frame' datasource='o_salon'>
SELECT * FROM dbo.Frames WHERE FrameID = '#URL.Frame#' </cfquery> <cfinclude
template='0000032P2.cfm'> <form name='imageform' method='post' action=''>
<cfif isdefined('session.arrMyFav')> <cfloop index='idx' from='1'
to='#ArrayLen(session.arrMyFav)#'> <cfoutput> <img
src='../galleries/Images/#session.arrMyFav[idx][2]#'> <select
name='Sel#idx#' size='5'
onChange='MM_goToURL('parent','Builder.cfm?Frame=# URL.Frame#&Image=#session.
arrMyFav[idx][2]#&Quad=document.imageform.Sel#idx#.value');ret urn
document.MM_returnValue'> <cfloop index='idx' from='1'
to='#Get_Frame.Frame_Quad#'> <option value='#idx#'>Quad #idx#</option>
</cfloop> </select> </cfoutput> </cfloop> </cfif> </form>
jolejni Guest
-
zoeski80 #4
Re: Passing the value of a Dynamic List
You want it to evaluate the document.imageform.Sel#idx#.value part so you can't
include it in the string otherwise it just thinks it is text, you need to put
it outside the string so it is evaluated ... something like this ...
- Zoe
MM_goToURL('parent','Builder.cfm?Frame=#URL.Frame# &Image=#session.arrMyFav[idx][
2]#&Quad=' + document.imageform.Sel#idx#.value);
zoeski80 Guest



Reply With Quote

