473,385 Members | 1,647 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Having trouble with iif and quotes

219 100+
I'm having an issue with quotes and double quotes on my iif statement. I'm trying to call a javascript function but can't seem to get the syntax correct. I know it's failing because I have this setup: <a href="javascript:alert('hi');">. I don't know how I can setup the quotes in order to get this working properly. It could just be friday, but I've been tinkering around with this, and am truly stumped now.

#iif(session.access eq 'admin',
DE("<li><a href="javascript:alert('hi');">Administration</a></li>"),DE(''))#

"an expression beginning with "iif", on line 72, column 14.This message is usually caused by a problem in the expressions structure."
Jul 18 '08 #1

✓ answered by acoder

You need to escape the quotes:
Expand|Select|Wrap|Line Numbers
  1. #iif(session.access eq 'admin',
  2.             DE("<li><a href=\"javascript:alert('hi');\">Administration</a></li>"),DE(''))#
Not directly related to the problem, but I would avoid the javascript: protocol in href. Use something like:
Expand|Select|Wrap|Line Numbers
  1. <a href=\"##\" onclick=\"alert('hi');\">Administration</a>
The pound sign needs to be escaped too hence the double pound.

3 3640
acoder
16,027 Expert Mod 8TB
You need to escape the quotes:
Expand|Select|Wrap|Line Numbers
  1. #iif(session.access eq 'admin',
  2.             DE("<li><a href=\"javascript:alert('hi');\">Administration</a></li>"),DE(''))#
Not directly related to the problem, but I would avoid the javascript: protocol in href. Use something like:
Expand|Select|Wrap|Line Numbers
  1. <a href=\"##\" onclick=\"alert('hi');\">Administration</a>
The pound sign needs to be escaped too hence the double pound.
Jul 19 '08 #2
dmorand
219 100+
You need to escape the quotes:
Expand|Select|Wrap|Line Numbers
  1. #iif(session.access eq 'admin',
  2.             DE("<li><a href=\"javascript:alert('hi');\">Administration</a></li>"),DE(''))#
Not directly related to the problem, but I would avoid the javascript: protocol in href. Use something like:
Expand|Select|Wrap|Line Numbers
  1. <a href=\"##\" onclick=\"alert('hi');\">Administration</a>
The pound sign needs to be escaped too hence the double pound.
Excellent, thanks acoder!!!
Jul 21 '08 #3
acoder
16,027 Expert Mod 8TB
You're welcome. Glad to help :)
Jul 21 '08 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

9
by: Penn Markham | last post by:
Hello all, I am writing a script where I need to use the system() function to call htpasswd. I can do this just fine on the command line...works great (see attached file, test.php). When my...
3
by: Thorsten Walenzyk | last post by:
Hi all, I'm pretty new to PHP. So far I know regular expression only from Perl I've written a perl script which I now want to port to PHP. It works in PErl, but gives my a headache in PHP. ...
1
by: Weston C | last post by:
In the course of trying to build a simple clock, I've run into a problem using the setInterval (and setTimeout) function. http://weston.canncentral.org/misc/tkeep/tkeep.html...
0
by: allanpat | last post by:
This is a site i'm working on: http://www.mazdablue.com The stylesheet fonts look just fine under windows, but as I was QAin it on IE 5 mac, some parts of the text are formatted according to...
2
by: Danny | last post by:
I am doing this on a table in a database. sql query = "select all names where instr(sourcefield,searchstring) > 0" this fails when there is embedded quotes in sourcefield such as "the book...
11
by: 2D Rick | last post by:
I need help getting this syntax to work. I want to open a form to a specific record based on dual criteria. Both fields are text fields as is the input. I get an error message "type mismatch" ...
7
by: Mike Joseph | last post by:
I have a data file that was produced in MicroSoft Access. It's a table that was exported as a fixed format, sequential access ASCII file. It contains over 80,000 records. Basically, all the stats...
5
by: Fernando Rodríguez | last post by:
Hi, I'm sending the follwoing query to mysql from a php script: ---------------------------------------------------------------------------------------- INSERT INTO affiliates (aff_id,...
2
by: sanderson82 | last post by:
Hi I am having problems with the HAVING clause. I know it can use aliases but the alias I am using has a space in it, eg 'Device ID' My querry looks like (simplified, devID is a calculation) ...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.