Click to See Complete Forum and Search --> : Links show despite zero value


Illufox
08-09-2004, 06:30 PM
I'm trying to display links from URL's that were entered into text fields. I don't want the links to show if the user didn't enter a URL for one of the text fields. This would be easy if I wanted to show the URL's itsef, but instead I want to show the link names and this is where the problem is.

Here is the code that doesn't work. I've tried several things but nothing seems to work, the links without values still show.

<%
If [(SEDReport.Fields.Item("AdproTemplates").Value) = ""] Then
Response.Write("")
Else
Response.Write("<a href="[SEDReport.Fields.Item("AdproTemplates").Value]">Adpro Templates</a>")
End If
%>

I've also tried this:

If [SEDReport.Fields.Item("AdproTemplates").Value = ""] Then
Response.Write("")
Else
%>
<a href="<%=(SEDReport.Fields.Item("AdproTemplates").Value)%>">Adpro Templates</a><br>
<%
End If
%>

All I need to know is how to make this code work. I'm quite new to this.

I use Dreamweaver MX, Access 2002 and ASP VBScript.

Thanks :)

Illufox
08-10-2004, 11:21 AM
Never mind, I just figured it out:

<%
If (SEDReport.Fields.Item("AdproTemplates").Value <> "") Then
%>
<a href="<%=(SEDReport.Fields.Item("AdproTemplates").Value)%>">Adpro Templates</a><br>
<%
Else
Response.Write("")
End If
%>

I don't really know what "<>" stands for but it seems to do the trick! :)

russell
08-10-2004, 05:41 PM
It stands for Not Equal To

Illufox
08-10-2004, 06:13 PM
Thanks, I wasn't able to find an answer to this anywhere on the web...isn't that strange? I just learned something new :)

I wonder why this doesn't work:

value = ""

but this does work

value <> ""

Seems to be the same to me if the statement after is correct.....

Guess I'm thinking too much JavaScript... :)

buntine
08-10-2004, 06:40 PM
Its the opposite thing.

If you were check if the valud was equal to zero, then nothing would ever be put into the HTML tag. Because it would either return false or return true, but have no data to enter.

Checking if it is not empty will ensure that there is something inside the collection member before you try to do something with it.

Regards.

Illufox
08-11-2004, 10:52 AM
Still doesn't make sense to me because both times we check for "" which is "nothing" or "empty"....Guess that's why I'm not a programmer....

Thanks for trying to explain, I will remember to use the <> whenver I try to check for a value... :)