Passing the value of a Dynamic List

Ask a Question related to Coldfusion - Advanced Techniques, Design and Development.

  1. #1

    Default 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#</cfoutput
    >&amp;Image=<cfoutput>#session.arrMyFav[idx][2]#</cfoutput>');return
    document.MM_returnValue'> <cfloop index='idx' from='1'
    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

  2. Similar Questions and Discussions

    1. 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...
    2. 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...
    3. 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...
    4. 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...
    5. 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...
  3. #2

    Default 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

  4. #3

    Default 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#&amp;Image=#session.
    arrMyFav[idx][2]#&amp;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

  5. #4

    Default 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

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139