Show/hide link based on db field value

Posted on 2003-03-21
Medium Priority
Last Modified: 2013-12-24
Is it possible to hide/show a hyperlink based on the value of a database field?
It's a bit like a forum structure, so if there is a better way then that would be good to know.

In my case...
A record has a status either "open" or "closed"
If the status is "open", then users can enter sub-records (responses) against it by clicking on a link to respond/reply.
If the status is "closed", then I either want to
 a) make the respond link unavailable
 b) when the link is clicked, give them a message and take them to the previous page.

Help would be appreciated.

Question by:CraigBFG
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
LVL 19

Expert Comment

ID: 8181287
Sure. You need to check the value of the field, and output the HTML based on that. And if/then/else works fine.

I don't think there's an option for this built into FrontPage, though. If you're going to start doing things that aren't part of the wizards, you're going to have to learn how to code them yourself.
LVL 14

Expert Comment

ID: 8183816

<% If Request.Form("FieldName")="Open" Then %>
Your hyperlink
Your other hyp
<%End If%>

I did not try it but it should work.

LVL 14

Accepted Solution

hhammash earned 300 total points
ID: 8185460

Here is a working example:

<% If Request.Form("Country")="USA" Then %>
<p><a href="http://www.yahoo.com">www.yahoo.com</a></p>
<p><a href="http://www.yahoo.com">www.Google.com</a></p>
<%End If%>

WordPress Tutorial 3: Plugins, Themes, and Widgets

The three most common changes you will make to your website involve the look (themes), the functionality (plugins), and modular elements (widgets).

In this article we will briefly define each again, and give you directions on how to install them.


Expert Comment

ID: 8186536
The solution to this is simple. Do the grunt work before you get to FrontPage. In your MS Access query us an iif statement that will display a hyperlink IF status=open and no link if status=closed.

To do this:

In your table make sure you have a field called Hyperlink and one called Status.

Now, in your query, right click in the first row of a blank query column and type the following the expression builder:

Link: iif([Status]="Open",[Hyperlink],"")

This will create a new field in the query called "Link" which will display the hyperlink only if the Status field = Open.

Make sure when you type the hyperlink into your table that you type in the entire code:

<a href="link">Caption</a>

replace "link" with the web address and "Caption" with the text you want the link to display.

In FP, when you create the DRW page, double click on the Link field value to open the field properties and select "Includes HTML". This will tell it to display the link as a hyperlink.

For more info on the iff statement, check out this tutorial.

I hope this helps

Author Comment

ID: 8193757
With slight mod' works perfectly. Completed code :-

' --------------------------------------------------
' Hides response hyperlink if status=closed
' --------------------------------------------------
If FP_FieldVal(fp_rs,"Status")="Open" Then %>
<p><a href="client_defect_response.asp">Defect</p>
End If
' --------------------------------------------------

Thanks hhammash, another great tip!
LVL 14

Expert Comment

ID: 8196416

Thank you.

You are most welcome CraigBFG.


Featured Post

Will your db performance match your db growth?

In Percona’s white paper “Performance at Scale: Keeping Your Database on Its Toes,” we take a high-level approach to what you need to think about when planning for database scalability.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Now that Expression Web 4.0 (http://www.microsoft.com/expression/products/Upgrade.aspx) is free if you buy or have the full version of Expression Web 3.0, now is the best time to  migrate from FrontPage to Expression Web (http://www.frontpage-to-exp…
Objective of This Article In 1990’s, when I was a budding software professional, I had a lot of confusion about which stream or technology, I had to choose to build my career. In those days, I had lot of confusion like whether to choose System so…
The purpose of this video is to demonstrate how to connect a WordPress website to Google Analytics. This will be demonstrated using a Windows 8 PC Go to your WordPress login page. This will look like the following: mywebsite.com/wp-login.php :…
The purpose of this video is to demonstrate how to prevent comment spam on a WordPress Website. This will be demonstrated using a Windows 8 PC. Plugin Akismet will be used. Go to your WordPress login page. This will look like the following: myw…
Suggested Courses

765 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question