...

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



phillip_ewing
01-25-2003, 12:34 AM
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>
<br>
<OPTION SELECTED>Teacher
<OPTION>Parent
<OPTION>Student
</SELECT>"


Thank you in advance, Phillip

Feyd
01-25-2003, 12:44 AM
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:


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


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

whammy
01-25-2003, 12:47 AM
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

whammy
01-25-2003, 12:48 AM
LOL, posted while Feyd was posting... ;)

Feyd
01-25-2003, 12:49 AM
ROFL, we did almost the exact identical code! :thumbsup:

whammy
01-25-2003, 12:50 AM
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:


<tr>
<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>
</select>
</td>
</tr>


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". ;)

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

Thanks again

:thumbsup:



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum