Forum Home
Press F1
 
Thread ID: 39736 2003-11-15 21:06:00 The Limitations of ASP agent (30) Press F1
Post ID Timestamp Content User
192231 2003-11-15 21:06:00 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?
agent (30)
192232 2003-11-15 21:42:00 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}
sc0ut (2899)
192233 2003-11-15 22:51:00 I've checked my asp code; I suffer no such problem using double quotes outsite the asp tags. Dolby Digital (160)
192234 2003-11-15 23:11:00 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.
mejobloggs (264)
192235 2003-11-16 01:58:00 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.
Graham L (2)
192236 2003-11-16 02:47:00 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
Erin Salmon (626)
1