Selected is not working!!! help please!

Ask a Question related to Coldfusion - Getting Started, Design and Development.

  1. #1

    Default Selected is not working!!! help please!

    The item on my drop down list is not selected correctly and all show the first
    item.
    Is this because I use <cfloop query=""> instead of <cfoutput query="">
    surrounding the select tags?
    I can't use 2 <cfoutput> nested within each other since it will generates
    error that's why I'm using <cfloop> instead.
    Otherwise why this code does not work??? it seems so simple, please help!
    <select name="InfoList">
    <cfloop query="getAllInfo">
    <option value="#InfoID#" <cfif #Bgs.Info# EQ
    #getAllInfo.InfoID#>Selected</cfif>>#Name# <<<< this always select 1st item
    </cfloop>
    </select>

    HERE IS THE BIGGER PICTURE:

    <cfquery name="Bgs" datasource="wbt">
    Select * From BgTr <cfif IsDefined("url.lc")> where AppID =
    #URL.Lc#</cfif>
    </cfquery>

    <cfoutput query="Bgs">
    alecken Guest

  2. Similar Questions and Discussions

    1. #38816 [Opn]: PHP code that was working perfectly recently stopped working.
      ID: 38816 User updated by: mtoohee at gmail dot com -Summary: PHP code that was working perfectly recently stopped....
    2. selected= not working in cfselect
      I am working on my admin interface for a department and I need to have a cfselect actually hilight the value that is passed from a query (like it is...
    3. Macromedia Flash Player installed and working properly suddenlys stops working..
      No idea what has caused the Flash player to stop working. This is not my machine but a relatives who has asked for help over the T'giving...
    4. #25474 [NEW]: posting arrays from a multiply selected select box not working properly
      From: fmuller at cisco dot com Operating system: redhat 7.3 PHP version: 4.3.3 PHP Bug Type: *Web Server problem Bug...
    5. Eraser tool not working when brush or pencil mode is selected.
      After I upgraded to Windows Photoshop seven. I have not been able to get the eraser tool to work in any other way except in block format. I know...
  3. #2

    Default Re: Selected is not working!!! help please!

    Since you didn't specify a row number for getAllInfo here:
    <cfif #Bgs.Info# EQ #getAllInfo.InfoID#>

    you always get the first record. By the way, you don't need octothorps inside a cfif tag.
    Dan Bracuk Guest

  4. #3

    Default Re: Selected is not working!!! help please!

    Hi!
    Row number? can you provide example? I always do like what I did without row number and never had problem.

    alecken Guest

  5. #4

    Default Re: Selected is not working!!! help please!

    this
    <cfif #Bgs.Info# EQ #getAllInfo.InfoID#>
    should be this
    <cfif Bgs.Info EQ getAllInfo.InfoID[currentrow]>


    Originally posted by: alecken
    Hi!
    Row number? can you provide example? I always do like what I did without row
    number and never had problem.




    Dan Bracuk Guest

  6. #5

    Default Re: Selected is not working!!! help please!

    Hi Alecken,

    Instead of using this ..

    <select name="InfoList">
    <cfloop query="getAllInfo">
    <option value="#InfoID#" <cfif #Bgs.Info# EQ
    #getAllInfo.InfoID#>Selected</cfif>>#Name# <<<< this always select 1st item
    </cfloop>
    </select>


    use this .............

    <cfset BgsInfo=trim(Bgs.Info)>
    <cfset getAllInfoInfoID=trim(getAllInfo.InfoID)>

    <select name="InfoList">
    <cfloop query="getAllInfo">
    <option value="#getAllInfo.InfoID#" <cfif BgsInfo EQ
    getAllInfoInfoID>Selected</cfif>>#getAllInfo.Name# </option>
    </cfloop>
    </select>



    reenaroy 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