Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

hyperlink query

  • 05-02-2009 4:34pm
    #1
    Registered Users, Registered Users 2 Posts: 224 ✭✭


    Hi,

    Im having an issue getting an image link (addimage16.gif) to act as a hyperlink in the repeat region. This should carry through the Prodid to the next page...(see below).

    Any ideas?

    **************

    <% 'ProdID, ItemID, ProdDesc,TotalQty , QtyPerCarton, ProdLgPic, DeliveryDate, Delivered
    while not rsAvalibleItems.EOF
    Response.Write("<tr class=""tblItems"" ><td width=""50""><img src="""&rsAvalibleItems("BrandLogo")&""" width=""47"" height=""50""></td>"&vbCrLf)
    Response.Write("<td width=""110"">"&rsAvalibleItems("ItemID")&"</td>"&vbCrLf)
    Response.Write("<td width=""224"">"&rsAvalibleItems("ProdDesc")&"</td>"&vbCrLf)
    Response.Write("<td width=""85"">"&rsAvalibleItems("TotalQty")&"</td>"&vbCrLf)
    Response.Write("<td width=""60"">"&rsAvalibleItems("QtyPerCarton")&"</td>"&vbCrLf)
    Response.Write ("<input type=""hidden"" name=""ProdID"" value="""&rsAvalibleItems("ProdID")&""">")
    Response.Write("<td width=""190""><select name=""QtyOfCartons"" class=""txtbox"">"&vbCrLf)
    Response.Write("<option value=""0"">-- Please Make Selection --</option>"&vbCrLf)
    Qty=rsAvalibleItems("TotalQty")
    Carton=rsAvalibleItems("QtyPerCarton")
    i=1
    max=5000
    if max>Qty then max=Qty
    while i*Carton<=max
    Response.Write("<option value="""&i&""">"&i*Carton&" ("&i&" Packs)</option>"&vbCrLf)
    i=i+1
    wend
    Response.Write(" </select></td><td width=""53""><img src=""prodimages/thumbs/")
    If rsAvalibleItems("ProdLgPic")<>"" then
    Response.Write(rsAvalibleItems("ProdLgPic")&""" width=""50"" height=""50"" target=""_blank"" "&_
    "onclick=""NewWindow('prodimages/LargeImg/"&rsAvalibleItems("ProdLgPic")&"','name','580','650','no');return false;"">")
    else
    Response.Write("<a href=""addthumbimg.asp?")
    Response.Write(Server.HTMLEncode(MM_keepForm) & MM_joinChar(MM_keepForm) & "ProdID=")
    Response.Write(rsAvalibleItems.Fields.Item("ProdID").value )
    response.Write(">" &vbCrLf)
    Response.Write("<img src=" )
    Response.Write("siteimgs/addimage16.gif")
    Response.Write(">" &vbCrLf)
    Response.Write("</a>" &vbCrLf)
    Response.Write("</td>" &vbCrLf)
    end if
    Response.Write("</tr>")
    rsAvalibleItems.movenext()
    wend
    %>


Comments

  • Registered Users, Registered Users 2 Posts: 605 ✭✭✭PaddyTheNth


    Pretty sure youre missing a few quotes in there. Don't have time to look at it properly now, but can you build it and look at the outputted html source? That should give you a few clues.

    response.Write("'>" &vbCrLf)
    Response.Write("<img src='" )
    Response.Write("siteimgs/addimage16.gif")
    Response.Write("'>" &vbCrLf)
    Response.Write("</a>" &vbCrLf)
    Response.Write("</td>" &vbCrLf)
    end if
    Response.Write("</tr>")
    rsAvalibleItems.movenext()
    wend
    %>

    Could be way off...

    Also why all the CrLfs?


  • Registered Users, Registered Users 2 Posts: 224 ✭✭The Mighty Dubs


    Cheers for the reply but that didnt work unfortunately, the image still isnt acting as a link...


  • Registered Users, Registered Users 2 Posts: 1,825 ✭✭✭Gambler


    Response.Write("<a href=""addthumbimg.asp?")
    Response.Write(Server.HTMLEncode(MM_keepForm) & MM_joinChar(MM_keepForm) & "ProdID=")
    Response.Write(rsAvalibleItems.Fields.Item("ProdID").value )
    response.Write(""">" &vbCrLf)

    You've got an open quotes at the beginning of the link but no close quotes


  • Registered Users, Registered Users 2 Posts: 605 ✭✭✭PaddyTheNth


    Cheers for the reply but that didnt work unfortunately, the image still isnt acting as a link...
    Show us the source of the page when you've built it - that'll show where the error is in the generated html...it can be hard to track down this sort of thing when you're building html in lots of fragments.


  • Registered Users, Registered Users 2 Posts: 224 ✭✭The Mighty Dubs


    Here you go. Here is the entire page

    **************************


    <%@LANGUAGE=&quot;VBSCRIPT" CODEPAGE="1252"%>
    <%
    Dim MM_paramName
    %>
    <%
    ' *** Go To Record and Move To Record: create strings for maintaining URL and Form parameters

    Dim MM_keepNone
    Dim MM_keepURL
    Dim MM_keepForm
    Dim MM_keepBoth

    Dim MM_removeList
    Dim MM_item
    Dim MM_nextItem

    ' create the list of parameters which should not be maintained
    MM_removeList = "&index="
    If (MM_paramName <> "") Then
    MM_removeList = MM_removeList & "&" & MM_paramName & "="
    End If

    MM_keepURL=""
    MM_keepForm=""
    MM_keepBoth=""
    MM_keepNone=""

    ' add the URL parameters to the MM_keepURL string
    For Each MM_item In Request.QueryString
    MM_nextItem = "&" & MM_item & "="
    If (InStr(1,MM_removeList,MM_nextItem,1) = 0) Then
    MM_keepURL = MM_keepURL & MM_nextItem & Server.URLencode(Request.QueryString(MM_item))
    End If
    Next

    ' add the Form variables to the MM_keepForm string
    For Each MM_item In Request.Form
    MM_nextItem = "&" & MM_item & "="
    If (InStr(1,MM_removeList,MM_nextItem,1) = 0) Then
    MM_keepForm = MM_keepForm & MM_nextItem & Server.URLencode(Request.Form(MM_item))
    End If
    Next

    ' create the Form + URL string and remove the intial '&' from each of the strings
    MM_keepBoth = MM_keepURL & MM_keepForm
    If (MM_keepBoth <> "") Then
    MM_keepBoth = Right(MM_keepBoth, Len(MM_keepBoth) - 1)
    End If
    If (MM_keepURL <> "") Then
    MM_keepURL = Right(MM_keepURL, Len(MM_keepURL) - 1)
    End If
    If (MM_keepForm <> "") Then
    MM_keepForm = Right(MM_keepForm, Len(MM_keepForm) - 1)
    End If

    ' a utility function used for adding additional parameters to these strings
    Function MM_joinChar(firstItem)
    If (firstItem <> "") Then
    MM_joinChar = "&"
    Else
    MM_joinChar = ""
    End If
    End Function
    %>

    <!--#include file="includes/incSQLConnection.asp" -->
    <!--#include file="includes/incAccess.asp" -->
    <!--#include file="includes/incMessage.asp" -->
    <%
    'usage: access ( brand, supplier, rep) (super users always have access)
    Call access(1,0,1)

    Dim UID, GID, BrandID, Num, n

    UID = Session("UID")
    GID = Session("GID")
    Num = request.form("BrandID").count

    if Num<1 then message("Please select a valid Brand")
    'Response.Write(BrandID)

    ' -- Open an sql connection
    dim strSQL
    objConn.Open strConnection


    DisplayHTMLForm

    ' -- Make sure nothing else gets processed
    objConn.Close
    set objConn = Nothing
    Response.End


    '
    ' Sub Routine: DisplayHTMLForm
    '
    Sub DisplayHTMLForm()
    dim rsAvalibleItems
    dim i, Qty, Carton, max

    ' ** Get list of avalible items
    Set rsAvalibleItems = Server.CreateObject("ADODB.Recordset")

    strSQL = "SELECT tblBrands.BrandLogo, tblBrands.BrandName, tblItems.ProdID, tblItems.ItemID, tblItems.ProdDesc, tblItems.TotalQty, tblItems.QtyPerCarton, tblItems.ProdLgPic "&_
    "FROM tblItems INNER JOIN tblBrands ON tblBrands.BrandID=tblItems.BrandID WHERE tblItems.TotalQty>0 AND ("
    for n=1 to Num
    if not n=1 then strSQL=strSQL&" OR "
    strSQL=strSQL&"tblItems.BrandID='"&Replace(request.form("BrandID")(n),"'","''")&"'"
    next
    strSQL=strSQL&")"


    set rsAvalibleItems = objConn.Execute (strSQL)

    ' No avalible Items returned. Let user know.
    If rsAvalibleItems.EOF AND rsAvalibleItems.BOF Then message("Sorry, There are no items for your selected Brand(s) in stock.<br /><br /><a href=""Order.asp"">Back to Stock System</a><br />")


    Dim PageTitle
    PageTitle=" Stock System"


    ' Call HTML head %>
    <!--#include file="includes/incHtmlHead.asp" -->
    <% '
    ' Place any javascript below
    '
    %>
    <SCRIPT LANGUAGE="JavaScript">
    <!-- Begin
    function NewWindow(mypage, myname, w, h, scroll) {
    var winl = (screen.width - w) / 2;
    var wint = (screen.height - h) / 2;
    winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars='+scroll+',resizable'
    win = window.open(mypage, myname, winprops)
    if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); }
    }
    // End -->
    </script>

    <% '
    ' Call Navigation inc
    '
    %>
    <!--#include file="includes/incNavigation.asp" -->
    <% '
    ' Now place body html
    '
    %>
    <tr>
    <td><div align="center" ><br />Please make your selection below.<br /><br />
    </div>
    <form name="StockByBrand" method="post" action="ConfirmOrder.asp">
    <input type="hidden" name="PASS" value="1" />
    <table border="0" cellspacing="1" cellpadding="1">
    <tr class="tblHead">
    <td width="50"></td>
    <td width="110"> Item ID</td>
    <td width="224">Item Description</td>
    <td width="85">Available Stock</td>
    <td width="60">Pack Size</td>
    <td width="190">Order Quantity</td>
    <td width="53">Visual</td>
    <td width="28">Add New Visual</td>
    </tr></table>
    <div style="overflow:auto; height:300px;">
    <table border="0" cellspacing="1" cellpadding="1">
    <% 'ProdID, ItemID, ProdDesc,TotalQty , QtyPerCarton, ProdLgPic, DeliveryDate, Delivered
    while not rsAvalibleItems.EOF
    Response.Write("<tr class=""tblItems"" ><td width=""50""><img src="""&rsAvalibleItems("BrandLogo")&""" width=""47"" height=""50""></td>"&vbCrLf)
    Response.Write("<td width=""110"">"&rsAvalibleItems("ItemID")&"</td>"&vbCrLf)
    Response.Write("<td width=""224"">"&rsAvalibleItems("ProdDesc")&"</td>"&vbCrLf)
    Response.Write("<td width=""85"">"&rsAvalibleItems("TotalQty")&"</td>"&vbCrLf)
    Response.Write("<td width=""60"">"&rsAvalibleItems("QtyPerCarton")&"</td>"&vbCrLf)
    Response.Write ("<input type=""hidden"" name=""ProdID"" value="""&rsAvalibleItems("ProdID")&""">")
    Response.Write("<td width=""190""><select name=""QtyOfCartons"" class=""txtbox"">"&vbCrLf)
    Response.Write("<option value=""0"">-- Please Make Selection --</option>"&vbCrLf)
    Qty=rsAvalibleItems("TotalQty")
    Carton=rsAvalibleItems("QtyPerCarton")
    i=1
    max=5000
    if max>Qty then max=Qty
    while i*Carton<=max
    Response.Write("<option value="""&i&""">"&i*Carton&" ("&i&" Packs)</option>"&vbCrLf)
    i=i+1
    wend
    Response.Write(" </select></td><td width=""53""><img src=""prodimages/thumbs/")
    If rsAvalibleItems("ProdLgPic")<>"" then
    Response.Write(rsAvalibleItems("ProdLgPic")&""" width=""50"" height=""50"" target=""_blank"" "&_
    "onclick=""NewWindow('prodimages/LargeImg/"&rsAvalibleItems("ProdLgPic")&"','name','580','650','no');return false;"">")
    else
    Response.Write("<a href=""addthumbimg.asp?")
    Response.Write(Server.HTMLEncode(MM_keepForm) & MM_joinChar(MM_keepForm) & "ProdID=")
    Response.Write(rsAvalibleItems.Fields.Item("ProdID").value )
    response.Write(""">" &vbCrLf)
    Response.Write("<img src='" )
    Response.Write("siteimgs/addimage16.gif")
    Response.Write("'>")
    Response.Write("</a>" )
    Response.Write("</td>" )
    end if
    Response.Write("</tr>")
    rsAvalibleItems.movenext()
    wend
    %>
    </table>
    </div>
    <br/><br/>
    <div align="right"><input name="Submit" type="Submit" value="Submit" class="button"/>      </div><br/>
    </form>
    </td></tr>

    <% '
    ' Call Footer inc
    '
    %>
    <!--#include file="includes/incFooter.asp" -->
    <% End Sub %>


  • Advertisement
  • Registered Users, Registered Users 2 Posts: 605 ✭✭✭PaddyTheNth


    I mean the source of the webpage that you're trying to make...the one that pops up in the browser when you build/run the project. That way you can see what's wrong with the outputted syntax. If you're not building a webpage then my .net is even rustier than I thought:o

    Response.Write("<a href="'addthumbimg.asp?")
    Response.Write(Server.HTMLEncode(MM_keepForm) & MM_joinChar(MM_keepForm) & "ProdID=")
    Response.Write(rsAvalibleItems.Fields.Item("ProdID").value )
    response.Write("'>" &vbCrLf)
    Response.Write("<img src='" )
    Response.Write("siteimgs/addimage16.gif")
    Response.Write("'>")
    Response.Write("</a>" )
    Response.Write("</td>" )
    end if
    Response.Write("</tr>")

    Try that though...I always alternate double and single quotations just because it makes it easier for me to read.


  • Registered Users, Registered Users 2 Posts: 1,045 ✭✭✭Bluefrog


    Too tired and lazy to read through the code completely and debug but I would suggest that you use a string builder and concarcenate the HTML you are currently using response.writes for - more efficient in terms of resources.

    I should go to bed :D


  • Closed Accounts Posts: 2,349 ✭✭✭nobodythere


    When you open the page in your browser go to View -> Source, that's the code we're looking for


Advertisement