Solved

IF display not working

Posted on 2013-10-28
11
247 Views
Last Modified: 2013-10-28
I am using classic ASP / javascript

I have the following lines:

<% if ((Permissions.SecBillingedit)== "True") { %>

VALUE
 
<% } // end Permissions.EOF && Permissions.BOF %>

It should display the value when 'secbillingedit' is equal to "True", but it doesnt. What is wrong ?

If I display the value of the field in on my screen  I get "True" ... so not sure what may be wrong.
0
Comment
Question by:amucinobluedot
  • 5
  • 5
11 Comments
 
LVL 32

Assisted Solution

by:Big Monty
Big Monty earned 500 total points
Comment Utility
if the database field is a boolean type, you just want to do:

<% if ( Permissions.SecBillingedit ) { %>

your original code is comparing the field to a string value of "True", not a boolean value
0
 
LVL 16

Expert Comment

by:Brian Pringle
Comment Utility
The <% and %> should be around the entire if statement, not each line.
0
 
LVL 32

Assisted Solution

by:Big Monty
Big Monty earned 500 total points
Comment Utility
no, thats inccorect. The <% %> can (and should be) on each line, especially if the part where the OP has VALUE is straight up html
0
 

Author Comment

by:amucinobluedot
Comment Utility
Did not work. Nothing is displayed. It shoud compare and make sure the boolean value is '1' .. in the database it shows '1', but when displayed on the ASP page it shows "True"
0
 

Author Comment

by:amucinobluedot
Comment Utility
The logic is correct, the 'value' or code I want to display is still not being displayed.

This is the complete code :

<% if ((Permissions.SecBillingedit)== "1") { %>

                          <a href="BillingItemsEdit.asp?ItemId=<%=(BillingItems.Fields.Item("Id").Value)%>&caseid=<%=(Casesjoin.Fields.Item("Id").Value)%>"><img src="../../Images/iedit.gif" width="16" height="16" border="0"></a>
                           
<% } // end Permissions.EOF && Permissions.BOF %>

I have tried and doesnt work with:

<% if ((Permissions.SecBillingedit)== "1") { %>
<% if ((Permissions.SecBillingedit)== "True") { %>
<% if ((Permissions.SecBillingedit)== '1') { %>
<% if ((Permissions.SecBillingedit)== 'True') { %>
0
Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

 
LVL 32

Assisted Solution

by:Big Monty
Big Monty earned 500 total points
Comment Utility
then try comparing it to 1 then:

if ((Permissions.SecBillingedit)== 1))
0
 

Author Comment

by:amucinobluedot
Comment Utility
Tried that, no go. Nothing is displayed.
0
 

Author Comment

by:amucinobluedot
Comment Utility
Close enough, this worked:

<% if (Permissions('SecBillingedit')== "1") { %>
0
 
LVL 32

Accepted Solution

by:
Big Monty earned 500 total points
Comment Utility
just to confirm, the database field "SecBillingedit" IS of a boolean type?

are you referencing that field any where else on the page?
0
 
LVL 32

Expert Comment

by:Big Monty
Comment Utility
excellent! glad you got it working :)
0
 

Author Closing Comment

by:amucinobluedot
Comment Utility
:)
0

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
This article discusses how to create an extensible mechanism for linked drop downs.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
Any person in technology especially those working for big companies should at least know about the basics of web accessibility. Believe it or not there are even laws in place that require businesses to provide such means for the disabled and aging p…

763 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

Need Help in Real-Time?

Connect with top rated Experts

6 Experts available now in Live!

Get 1:1 Help Now