PDA

View Full Version : The Limitations of ASP



agent
16-11-2003, 10:06 AM
I'm talking about here, where you might have code such as:
<input type="text" value='<%Request.Form("username")%>'>

Now, if you note carefully, in the value part of the tag, I have to use single quotation marks. Why? Because if double quotation marks are used, then it would put <%Request.Form( as the value of the form, and the rest of it would muck up, and ASP scripting complains about not finding closing delimiters, etc.

Now, I would like to know if anyone out there has found a way to get around this... because I'd prefer to have double quotation marks show in the generated HTML rather than a mismatch of single and double, or just single. I guess it's a matter of preference, but it is rather annoying.

And does PHP suffer from this problem?

sc0ut
16-11-2003, 10:42 AM
look @ w3schools.com
if its not under ASP look under VB
i'v had that problem befor in my ASP buy i got a friend to fix it :8}

Dolby Digital
16-11-2003, 11:51 AM
I've checked my asp code; I suffer no such problem using double quotes outsite the asp tags.

mejobloggs
16-11-2003, 12:11 PM
I dunno much anything about ASP, but I just heard that you had to put double (") on the outsides, and single ' on the insides.

I wouldnt know though.

Graham L
16-11-2003, 02:58 PM
You are running into the problem that quotes come in pairs. the interpreter sees a /"/. <<Aha, it thinks (in its anthropomorphic way), this is the start of a string. All I have to do is take everything up to the next /"/, and that is one string token.>>

Unfortunately, if you have intended to include a nested string inside that token, and you use the same /"/ delimiter around it, the interpreter will start to complain. It has to ... you have given it bad syntax, and interpreters can't understand bad syntax.

I don't know ASP (and don't want to :D), but I'd guess that you can use /"/ quote consistently at the outer level, but you will have to use /'/ as the delimeter at the inner level. I doubt if you can go any deeper.

Erin Salmon
16-11-2003, 03:47 PM
Hi agent,

I use exactly the code you are talking about in thousands of places across the sites I've built. I have no problems at all. However, I notice when you open the script tag you have no response.write. You are launching straight into the Request.Form("username").

Ideally:

<input type="text" value="<% response.write request.form("username")%>">

Alternatively, replace your;

<%

with;

<%=

which means;

<% response.write ...

This would give:

<input type="text" value="<%=Request.Form("username")%>">

Hope this helps,

Erin