Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
0

Removing a link when the database field is empty?

New Here ,
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
TOPICS
Server side applications

Views

244
Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 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...

Votes

Translate
LEGEND ,
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>
>
>


Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jun 14, 2006 Jun 14, 2006

Copy link to clipboard

Copied

LATEST
that was just what I wanted. thanks very much.

Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines