View Full Version : Can someone please help me convert this piece of code?

01-24-2003, 11:34 PM
Can someone please walk me thru converting the below asp code to do a html select? Below is what I have and it does not work.

What I need converted

Content = Content & "<tr><td valign=top bordercolor="& BackgroundColor &">Teacher, Parent, or Student: <input type=text name=txtPermission></td></tr>"

What I have now

Content = Content & "<tr><td valign=top bordercolor="& BackgroundColor &">Permission:<br>
<SELECT type=text name=txtPermission></td></tr>

Thank you in advance, Phillip

01-24-2003, 11:44 PM
Content = "<tr>" & vbcrlf
Content = Content & " <td valign=""top"" bordercolor=" & BackgroundColor & ">Permission:<br />" & vbcrlf
Content = Content & " <select type=""text"" name=""txtPermission"">" & vbcrlf
Content = Content & " <option selected>Teacher</option>" & vbcrlf
Content = Content & " <option>Parent</option>" & vbcrlf
Content = Content & " <option>Student</option>" & vbcrlf
Content = Content & " </select></td>" & vbcrlf
Content = Content & "</tr>" & vbcrlf

Of course, it is just easier to exit out of the ASP block and echo HTML code:

<td valign="top" bordercolor="<%=BackgroundColor%>">Permission:<br>
<select type=text name=txtPermission>

If you don't have short tags enabled, use <%response.write BackgroundColor%> instead.

01-24-2003, 11:47 PM
Content = Content & "<tr>" & vbCrLf
Content = Content & " <td valign=""top"" bordercolor=""" & BackgroundColor & """>Permission:<br />" & vbCrLf
Content = Content & " <select name=""txtPermission"">" & vbCrLf
Content = Content & " <option value=""Teacher"">Teacher</option>" & vbCrLf
Content = Content & " <option value=""Parent"">Parent</option>" & vbCrLf
Content = Content & " <option value=""Student"">Student</option>" & vbCrLf
Content = Content & " </select>"
Content = Content & " </td>" & vbCrLf
Content = Content & "</tr>" & vbCrLf

01-24-2003, 11:48 PM
LOL, posted while Feyd was posting... ;)

01-24-2003, 11:49 PM
ROFL, we did almost the exact identical code! :thumbsup:

01-24-2003, 11:50 PM
Yeah, experience I suppose. ;) I notice we also both fixed the select to reside within the table definition as well, and UNcapitalized all of the HTML tags, since that is deprecated and backwards compatible. :D

Like Feyd said though, in some cases it's easier just to echo ASP in your HTML like so:

<td valign="top" bordercolor="<% = BackgroundColor %>">Permission:<br />
<select name="txtPermission">
<option value="Teacher">Teacher</option>
<option value="Parent">Parent</option>
<option value="Student">Student</option>

However, if you're building all of the content of the page or whatever as a string (i.e. "Content"), you'd probably want to use the first method.

P.S. As far as I know there's no such thing as select type="text". ;)

01-25-2003, 01:26 AM
Wow!!! What a reply. Thanks to everybody. They all worked. I did not understand echo out of asp but it worked nonetheless.

Thanks again


EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum