Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Response.Write "<input type>"

Status
Not open for further replies.

bilebalar

IS-IT--Management
Mar 25, 2002
386
US
Hi, All.

I am stuck on this last piece of the code. Any help is appreciated!

I have a Response.Write statement

Response.Write _
"<input type=""checkbox"" name=""PC"" value=""blah"" If rsEqip(""PC"") = ""blah"" Then Response.Write ""Checked"" End If>blah" & _
.
.
.

The problem is, all the checkboxes are returned as CHECKED.
So my question is, how to make my IF statement work in the "<input type>" statement? Right now, it is obviously reading the "Checked" part, but how to make it to execute the IF statement??? If I don't use that <input type> statement in Response.Write, it works fine.

Thanks!!!

 
The problem is that your If/Then conditional is inside the string that you are outputting with Response.Write

So even though it is in VBScript syntax, it appears to the ASP interpretter as simply part of the output string... rather than as part of the code.

Just use the "View Source" feature on your browser to see what I mean about the output of your Response.Write.

To debug this problem, it will help to remove all of the "extra" double quotes:
Code:
Response.Write "<input type=checkbox name=PC value=blah "

If rsEqip("PC") = "blah" Then 
  Response.Write "Checked" 
End If

Response.Write ">blah"

After you get working the way you want then feel free to go back and add the extra quotes back so that they appear in your output.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top