0
New Here
,
/t5/dreamweaver-discussions/removing-a-link-when-the-database-field-is-empty/td-p/539846
Jun 14, 2006
Jun 14, 2006
Copy link to clipboard
Copied
Using ASP and Access - I'm making a listing of organisations
using repeated regions. Some require a link to their website,
others don't. The code I'm using is fine when an organisation has a
web address. However, those that don't still get the text "Website"
linked, but missing a URL as the relevant data field (orgWebsite)
is empty. I need to remove the linked word and the empty <a>
HTTP://</a> that is rendered when
a field is empty.
Ideally I want it to continue behaving as it does when a URL is present on the database but leave no code if absent. I'm fairly sure that this means the <A HREF= and the "Website" text should be contained within the ASP code but none of my attempts have worked. Appreciate any assistance on this....
Thanks
Ideally I want it to continue behaving as it does when a URL is present on the database but leave no code if absent. I'm fairly sure that this means the <A HREF= and the "Website" text should be contained within the ASP code but none of my attempts have worked. Appreciate any assistance on this....
Thanks
TOPICS
Server side applications
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
1 Correct answer
LEGEND
,
Jun 14, 2006
Jun 14, 2006
Assuming that your URL is stored in a field called URLLink
then the code
looks like this
<%
ThisLink = recordset.fields.item("URLLink").value
If ThisLink <> "" then
%>
Website: <a href=" http://<%=ThisLink%>"><%=ThisLink%></a>
<%End if%>
--
Paul Whitham
Certified Dreamweaver MX2004 Professional
Adobe Community Expert - Dreamweaver
Valleybiz Internet Design
www.valleybiz.net
"Lancs" <webforumsuser@macromedia.com> wrote in message
news:e6qddr$f9v$1@forums.macromedia.com...
> Using ASP and A...
looks like this
<%
ThisLink = recordset.fields.item("URLLink").value
If ThisLink <> "" then
%>
Website: <a href=" http://<%=ThisLink%>"><%=ThisLink%></a>
<%End if%>
--
Paul Whitham
Certified Dreamweaver MX2004 Professional
Adobe Community Expert - Dreamweaver
Valleybiz Internet Design
www.valleybiz.net
"Lancs" <webforumsuser@macromedia.com> wrote in message
news:e6qddr$f9v$1@forums.macromedia.com...
> Using ASP and A...
LEGEND
,
/t5/dreamweaver-discussions/removing-a-link-when-the-database-field-is-empty/m-p/539847#M195144
Jun 14, 2006
Jun 14, 2006
Copy link to clipboard
Copied
Assuming that your URL is stored in a field called URLLink
then the code
looks like this
<%
ThisLink = recordset.fields.item("URLLink").value
If ThisLink <> "" then
%>
Website: <a href=" http://<%=ThisLink%>"><%=ThisLink%></a>
<%End if%>
--
Paul Whitham
Certified Dreamweaver MX2004 Professional
Adobe Community Expert - Dreamweaver
Valleybiz Internet Design
www.valleybiz.net
"Lancs" <webforumsuser@macromedia.com> wrote in message
news:e6qddr$f9v$1@forums.macromedia.com...
> Using ASP and Access - I'm making a listing of organisations using
> repeated
> regions. Some require a link to their website, others don't. The code I'm
> using
> is fine when an organisation has a web address. However, those that don't
> still
> get the text "Website" linked, but missing a URL as the relevant data
> field
> (orgWebsite) is empty. I need to remove the linked word and the empty
> <a> HTTP://</a> that is rendered when a field is empty.
> Ideally I want it to continue behaving as it does when a URL is present on
> the
> database but leave no code if absent. I'm fairly sure that this means the
> <A
> HREF= and the "Website" text should be contained within the ASP code but
> none
> of my attempts have worked. Appreciate any assistance on this....
> Thanks
>
> <a href=" http://<%=rsOrgs.Fields.Item("orgWebsite").Value%>">Website</a>
>
>
looks like this
<%
ThisLink = recordset.fields.item("URLLink").value
If ThisLink <> "" then
%>
Website: <a href=" http://<%=ThisLink%>"><%=ThisLink%></a>
<%End if%>
--
Paul Whitham
Certified Dreamweaver MX2004 Professional
Adobe Community Expert - Dreamweaver
Valleybiz Internet Design
www.valleybiz.net
"Lancs" <webforumsuser@macromedia.com> wrote in message
news:e6qddr$f9v$1@forums.macromedia.com...
> Using ASP and Access - I'm making a listing of organisations using
> repeated
> regions. Some require a link to their website, others don't. The code I'm
> using
> is fine when an organisation has a web address. However, those that don't
> still
> get the text "Website" linked, but missing a URL as the relevant data
> field
> (orgWebsite) is empty. I need to remove the linked word and the empty
> <a> HTTP://</a> that is rendered when a field is empty.
> Ideally I want it to continue behaving as it does when a URL is present on
> the
> database but leave no code if absent. I'm fairly sure that this means the
> <A
> HREF= and the "Website" text should be contained within the ASP code but
> none
> of my attempts have worked. Appreciate any assistance on this....
> Thanks
>
> <a href=" http://<%=rsOrgs.Fields.Item("orgWebsite").Value%>">Website</a>
>
>
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
Lancs
AUTHOR
New Here
,
LATEST
/t5/dreamweaver-discussions/removing-a-link-when-the-database-field-is-empty/m-p/539848#M195145
Jun 14, 2006
Jun 14, 2006
Copy link to clipboard
Copied
that was just what I wanted. thanks very much.
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more

