Forums
This topic is locked
Multiple DB Field Instances On One Page
Posted 23 Jul 2002 20:33:09
1
has voted
23 Jul 2002 20:33:09 Jeremy Conn posted:
I need to use multiple instances of a DB field for an image selector thing I am creating, but am having a problem. It seems as if by default UD will only let me use one instance of a DB field on a page.<b>EXAMPLE:</b>
Here is the DB instance I am using...
<font color=green><%=(rsUploads1.Fields.Item("Image_Path".Value)%></font id=green>
...which works fine used once.
But, if I want to use it twice for this JavaScript thing I am trying to do below...
<font color=red><span onClick="ImageName('<%=(rsUploads1.Fields.Item("Image_Path".Value)%>')"></font id=red><font color=green><a href="javascript:void(0);"><img src="<%=(rsUploads1.Fields.Item("Image_Path".Value)%>" border="1" align="middle" onClick="self.close()"></font id=green>
...then only one of them shows up.
<b>END EXAMPLE</b>
Is there a protocol for using an instance twice on a page?
(DWMX|IIS5|WXP|ASP/VB)
*Connman21*
www.conncreativemedia.com
Replies
Replied 23 Jul 2002 23:13:57
23 Jul 2002 23:13:57 Owen Eastwick replied:
Hi Connman,
If you are using a recordset field multiple times on a page you should store it in a variable first. It's more efficient and the page should load quicker. e.g.
<% varImagePath = rsUploads1.Fields.Item("Image_Path".Value %>
<span onClick="ImageName('<%= varImagePath %>')"><a href="javascript:void(0);"><img src="<%= varImagePath %>" border="1" align="middle" onClick="self.close()">
However, not doing it wouldn't stop a page working, it's purely an efficiency thing. I'm not exactly sure why your code isn't working, I would be inclined to be more suspicious of the JavaScript. Have you tested it using a real image path rather than one from a database field.
Regards
Owen.
Multiple Parameter UD4 / Access 2000 Database Search Tutorial:
www.tdsf.co.uk/tdsfdemo
If you are using a recordset field multiple times on a page you should store it in a variable first. It's more efficient and the page should load quicker. e.g.
<% varImagePath = rsUploads1.Fields.Item("Image_Path".Value %>
<span onClick="ImageName('<%= varImagePath %>')"><a href="javascript:void(0);"><img src="<%= varImagePath %>" border="1" align="middle" onClick="self.close()">
However, not doing it wouldn't stop a page working, it's purely an efficiency thing. I'm not exactly sure why your code isn't working, I would be inclined to be more suspicious of the JavaScript. Have you tested it using a real image path rather than one from a database field.
Regards
Owen.
Multiple Parameter UD4 / Access 2000 Database Search Tutorial:
www.tdsf.co.uk/tdsfdemo
Replied 23 Jul 2002 23:45:02
23 Jul 2002 23:45:02 Jeremy Conn replied:
Replied 24 Jul 2002 01:16:56
24 Jul 2002 01:16:56 aegis kleais replied:
trust oeastwick on this connman21. I had the EXACT same problem. Place the database value into a variable and BAM, you can use it as many times as you want. I'll be getting DMX (actually, Studio MX) soon and I hope just for the fudge of it that I don't have to place everything into a variable all the time <img src=../images/dmxzone/forum/icon_smile.gif border=0 align=middle>
Aegis Kleais
New Media Web Developer
(DWMX : IIS5.1 : SQL2K : WXP : ASP[VB/JS])
Aegis Kleais
New Media Web Developer
(DWMX : IIS5.1 : SQL2K : WXP : ASP[VB/JS])
Replied 24 Jul 2002 01:39:56
24 Jul 2002 01:39:56 Jeremy Conn replied:
Replied 24 Jul 2002 01:43:16
24 Jul 2002 01:43:16 aegis kleais replied:
Up in the ASP code:
<%
variableName = recordsetName.Field.Item("fldFieldName".Value
%>
Then in your page code:
You son of a <%= variableName %>. Yeah! You heard me! I called you a son of a <%= variableName %>
Of course, your choice of words is optional and all.
Aegis Kleais
New Media Web Developer
(DWMX : IIS5.1 : SQL2K : WXP : ASP[VB/JS])
<%
variableName = recordsetName.Field.Item("fldFieldName".Value
%>
Then in your page code:
You son of a <%= variableName %>. Yeah! You heard me! I called you a son of a <%= variableName %>
Of course, your choice of words is optional and all.
Aegis Kleais
New Media Web Developer
(DWMX : IIS5.1 : SQL2K : WXP : ASP[VB/JS])