Ask a Question related to Macromedia ColdFusion, Design and Development.

  1. #1

    Default href help

    I'm pretty new to CF still and I have created a cfm page that retreives a
    specific record according to what was selected on the previous page. The record
    in the database may or may not have information in some of the fields to
    populatea "menu". The menu is just some buttons that bring up different
    information about the record. pdf files or htm, cfm pages. If I use
    "href='#variable#'" and there is no information for the variable from the
    database, clicking on the menu button returns to the index page rather than
    doing nothing.

    In short, I want the button to not do anything if there is no information in
    the record for the variable.
    Here is a portion of the code:

    <cfquery name="listing" datasource="listings">
    SELECT LISTNUM, LRGIMAGE, LISTING, MAP, DEMOGRAPHICS, PICTURES, SITEPLANS,
    BLDGPLANS, PARCEL
    FROM LISTINGS
    <cfif IsDefined("URL.ID")>
    WHERE LISTNUM = #Val(URL.ID)#
    </cfif>

    </cfquery>
    <cfoutput query="listing">
    <table border="0" cellpadding="0" cellspacing="0" style="border-collapse:
    collapse" bordercolor="##111111" width="600" id="AutoNumber2">
    <tr>
    <td width="14%">
    <a target="_blank" href="#MAP#">
    <img border="0" src="images/map.gif" width="85" height="23"></a></td>
    <td width="14%">
    <a target="_blank" href="#DEMOGRAPHICS#">
    <img border="0" src="images/demographicssm.gif" width="85"
    height="23"></a></td>
    <td width="14%">
    <a href="#PICTURES#">
    <img border="0" src="images/pictures.gif" width="85"
    height="23"></a></td>
    <td width="14%">
    <a href="#SITEPLANS#">
    <img border="0" src="images/siteplan.gif" width="85"
    height="23"></a></td>
    <td width="14%">
    <a href="#BLDGPLANS#">
    <img border="0" src="images/buildingplan.gif" width="85"
    height="23"></a></td>
    <td width="15%">
    <a target="_blank" href="#PARCEL#">
    <img border="0" src="images/comments.gif" width="85"
    height="23"></a></td>
    <td width="15%">
    <a target="_blank" href="#LISTING#">
    <img border="0" src="images/print.gif" width="85" height="23"></a></td>
    </tr>
    </table>
    </cfoutput>

    I'm sure there is a simple solution I'm overlooking. I appreciate any help.
    Thanks

    prpldude Guest

  2. Similar Questions and Discussions

    1. Help with href problem
      I try to make a link to see the upload file. The directory is correct but somehow it's unlinkable. Here is the code I have <cfoutput><cfif...
    2. cfformitem and HREF
      Can you post the sample code for underlining links in a flash from.
    3. href links
      My site has gone from 5 pages to 50 over this year. Every page has a sidebar, which includes the title, content and link to the other page on my...
    4. passing value via href
      How do I write a hyperlink that also passes a value to the destination php page? Thanks in advance. ~Duane.
    5. href code
      Hi How to write in c# href code so it looks in source Slide - pokaz programu - Remonty firmy Delta Software pls. look source of this link....
  3. #2

    Default Re: href help

    Here's one way to do it:

    <cfoutput query="listing">
    <table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="##111111" width="600"
    id="AutoNumber2">
    <tr>
    <td width="14%">
    <cfif listing.MAP NEQ "">
    <a target="_blank" href="#MAP#"><img border="0" src="images/map.gif" width="85" height="23"></a>
    <cfelse>
    <img border="0" src="images/map.gif" width="85" height="23">
    </cfif>
    </td>
    <td width="14%">
    <cfif listing.DEMOGRAPHICS NEQ "">
    <a target="_blank" href="#DEMOGRAPHICS#"><img border="0" src="images/demographicssm.gif" width="85" height="23"></a>
    <cfelse>
    <img border="0" src="images/demographicssm.gif" width="85" height="23">
    </cfif>
    </td>
    <td width="14%">
    <cfif listing.PICTURES NEQ "">
    <a href="#PICTURES#"><img border="0" src="images/pictures.gif" width="85" height="23"></a>
    <cfelse>
    <img border="0" src="images/pictures.gif" width="85" height="23">
    </cfif>
    </td>
    <td width="14%">
    <cfif listing.SITEPLANS NEQ "">
    <a href="#SITEPLANS#"><img border="0" src="images/siteplan.gif" width="85" height="23"></a>
    <cfelse>
    <img border="0" src="images/siteplan.gif" width="85" height="23">
    </cfif>
    </td>
    <td width="14%">
    <cfif listing.BLDGPLANS NEQ "">
    <a href="#BLDGPLANS#"><img border="0" src="images/buildingplan.gif" width="85" height="23"></a>
    <cfelse>
    <img border="0" src="images/buildingplan.gif" width="85" height="23">
    </cfif>
    </td>
    <td width="15%">
    <cfif listing.PARCEL NEQ "">
    <a target="_blank" href="#PARCEL#"><img border="0" src="images/comments.gif" width="85" height="23"></a>
    <cfelse>
    <img border="0" src="images/comments.gif" width="85" height="23">
    </cfif>
    </td>
    <td width="15%">
    <cfif listing.LISTING NEQ "">
    <a target="_blank" href="#LISTING#"><img border="0" src="images/print.gif" width="85" height="23"></a>
    <cfelse>
    <img border="0" src="images/print.gif" width="85" height="23">
    </cfif>
    </td>
    </tr>
    </table>
    </cfoutput>


    --
    Ken Ford
    PVII Support Team
    [url]http://www.projectseven.com[/url]
    Team Macromedia Volunteer - Dreamweaver
    Certified Dreamweaver MX 2004 Developer


    "prpldude" <webforumsuser@macromedia.com> wrote in message news:d9jfu8$3c3$1@forums.macromedia.com...
    > I'm pretty new to CF still and I have created a cfm page that retreives a
    > specific record according to what was selected on the previous page. The record
    > in the database may or may not have information in some of the fields to
    > populatea "menu". The menu is just some buttons that bring up different
    > information about the record. pdf files or htm, cfm pages. If I use
    > "href='#variable#'" and there is no information for the variable from the
    > database, clicking on the menu button returns to the index page rather than
    > doing nothing.
    >
    > In short, I want the button to not do anything if there is no information in
    > the record for the variable.
    > Here is a portion of the code:
    >
    > <cfquery name="listing" datasource="listings">
    > SELECT LISTNUM, LRGIMAGE, LISTING, MAP, DEMOGRAPHICS, PICTURES, SITEPLANS,
    > BLDGPLANS, PARCEL
    > FROM LISTINGS
    > <cfif IsDefined("URL.ID")>
    > WHERE LISTNUM = #Val(URL.ID)#
    > </cfif>
    >
    > </cfquery>
    > <cfoutput query="listing">
    > <table border="0" cellpadding="0" cellspacing="0" style="border-collapse:
    > collapse" bordercolor="##111111" width="600" id="AutoNumber2">
    > <tr>
    > <td width="14%">
    > <a target="_blank" href="#MAP#">
    > <img border="0" src="images/map.gif" width="85" height="23"></a></td>
    > <td width="14%">
    > <a target="_blank" href="#DEMOGRAPHICS#">
    > <img border="0" src="images/demographicssm.gif" width="85"
    > height="23"></a></td>
    > <td width="14%">
    > <a href="#PICTURES#">
    > <img border="0" src="images/pictures.gif" width="85"
    > height="23"></a></td>
    > <td width="14%">
    > <a href="#SITEPLANS#">
    > <img border="0" src="images/siteplan.gif" width="85"
    > height="23"></a></td>
    > <td width="14%">
    > <a href="#BLDGPLANS#">
    > <img border="0" src="images/buildingplan.gif" width="85"
    > height="23"></a></td>
    > <td width="15%">
    > <a target="_blank" href="#PARCEL#">
    > <img border="0" src="images/comments.gif" width="85"
    > height="23"></a></td>
    > <td width="15%">
    > <a target="_blank" href="#LISTING#">
    > <img border="0" src="images/print.gif" width="85" height="23"></a></td>
    > </tr>
    > </table>
    > </cfoutput>
    >
    > I'm sure there is a simple solution I'm overlooking. I appreciate any help.
    > Thanks
    >

    Ken Ford - *TMM* & PVII Guest

  4. #3

    Default Re: href help

    Thanks Ken that worked great. I appreciate your quick response and help.
    prpldude 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