Wrox Programmer Forums
|
ASP Forms As of Oct 5, 2005, this forum is now locked. Please use "Classic ASP beginner" at http://p2p.wrox.com/forum.asp?FORUM_ID=54 or "Classic ASP Professional" http://p2p.wrox.com/forum.asp?FORUM_ID=56 instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP Forms section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old August 17th, 2004, 04:05 PM
Authorized User
 
Join Date: Aug 2004
Posts: 16
Thanks: 0
Thanked 0 Times in 0 Posts
Default Does not display list content vertiaclly

Hi, the following code should normally display the elements within the SELECT tags vertically, but it does only display them horizontally no matter what I do. Everything works except for proper diplaying direction of the elements. I've tried different scenarios, but the outcome was the same. Am I missing something, or am I taking the wrong way? I'm new in ASP.

Thanks for your help..

<%
      Dim objConn, CourseNameVal
    Set objConn = Server.CreateObject("ADODB.Connection")
    objConn.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _
                 "Data Source=" & Server.MapPath(".") & "\CourseContent.mdb;" & _
                 "User ID=admin;" & _
                 "Password="

    Dim objRS
    Set objRS = Server.CreateObject("ADODB.Recordset")
    objRS.Open "CourseContentTable", objConn,,, adCmdTable
%>
<select>
        <option>
<%
    'Read course content table.
     Do until objRS.EOF
     CourseNameVal = objRS("CourseName")
     Response.Write CourseNameVal
%>
       <br /> -> I know this tag should not be here, but I'm miss
                   resources. With or without, it's the same.
<%
       objRS.MoveNext
     Loop
%>
        </option>
</select>

<%
     'Clean up everything.
     objRS.Close
     Set objRS = Nothing

     objConn.Close
     Set objConn = Nothing
%>


Ramez
__________________
Ramez
 
Old August 17th, 2004, 04:26 PM
Authorized User
 
Join Date: Aug 2004
Posts: 16
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi again,

I've found where was the problem. The problem was where I've put the two options tags. This new segment of the program is the correct segment that I'm putting here for helping others who might get the same problem.

Thanks if you've tried to help, but did not have the time to answer.

<%
      Dim objConn, CourseNameVal
    Set objConn = Server.CreateObject("ADODB.Connection")
    objConn.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _
                 "Data Source=" & Server.MapPath(".") & "\CourseContent.mdb;" & _
                 "User ID=admin;" & _
                 "Password="

    Dim objRS
    Set objRS = Server.CreateObject("ADODB.Recordset")
    objRS.Open "CourseContentTable", objConn,,, adCmdTable
%>
<select>

<%
    'Read course content table.
     Do until objRS.EOF
     CourseNameVal = objRS("CourseName")
%>
<option>
     <%= CourseNameVal %>
</option>

<%
       objRS.MoveNext
     Loop
%>

</select>

<%
     'Clean up everything.
     objRS.Close
     Set objRS = Nothing

     objConn.Close
     Set objConn = Nothing
%>


Ramez
 
Old August 17th, 2004, 05:30 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
Default

Yes, not to be forgotten, for every list item to be displayed, you should start with an <OPTION> tag and end with a </OPTION> tag. It is only enough to keep the SELECT tags outside the while loop.

Cheers!

_________________________
- Vijay G
Strive for Perfection
 
Old August 18th, 2004, 08:23 AM
Authorized User
 
Join Date: Aug 2004
Posts: 16
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks,

I will remember. Textarea tag is not as straitforward though. I'm working on it.

Cheers

Ramez



Ramez
 
Old August 19th, 2004, 12:22 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
Default

Textarea tag doesn't have value attribute as other input tags do. It has got to open with <textarea> and end with </textarea> the content comes inbetween those tags.

EG:
<textarea>My text is not your text, My text is not your text, My text is not your text, My text is not your text, My text is not your text</textarea>

Remeber, not to break the line before you close the textarea tag like this

<textarea>text
</textarea>

as it puts extra spaces/tab space within the control when viewed on the browser, and on focus the cursor is placed not on left top corner instead.

Hope that helps.
Cheers!

_________________________
- Vijay G
Strive for Perfection
 
Old August 20th, 2004, 01:34 PM
Authorized User
 
Join Date: Aug 2004
Posts: 16
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Yes, there was a lot of tabs or breaks in my text as you are pointing.
Finally, since I elected to use the "SELECT and GO" strategy, I decided to use the select and option tags which seem cleaner to me and more of practicle use in my situation.

Thanks again,

Cheers

Ramez





Similar Threads
Thread Thread Starter Forum Replies Last Post
Dynamic List Content cyberddindia Classic ASP Basics 3 October 24th, 2006 10:29 AM
Switching list content dynamically ... asearle XSLT 1 September 24th, 2006 11:41 AM
How to dynamic display the content of the table? myhrvod Pro Java 0 August 3rd, 2006 12:42 AM
Display pdf in content walgr2k ASP.NET 2.0 Basics 0 May 1st, 2006 05:19 PM
display content of upload file shs BOOK: Beginning ASP.NET 1.0 1 May 8th, 2004 04:51 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.