Wrox Programmer Forums
|
Classic ASP Basics For beginner programmers starting with "classic" ASP 3, pre-".NET." NOT for ASP.NET 1.0, 1.1, or 2.0
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Basics 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 October 1st, 2004, 02:23 PM
Registered User
 
Join Date: Sep 2004
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default Drop Down/Combox with Check box

Hi guys
I am new to ASP (traditional ASP not the .NET). I want to design a Form based on the user table something like this tUser(UniqueName, F_NAme, L_Name, MI)
When the page loads the user will see a combobox/list to pick the name from that table and after picking the name then should see on the same form the name of all the users in the tUSer table except the one who was selected in the combobox and names should be shown in the check boxes.
Thanks & Regards
Azimi

 
Old October 1st, 2004, 08:50 PM
Friend of Wrox
 
Join Date: Sep 2003
Posts: 363
Thanks: 0
Thanked 1 Time in 1 Post
Default

Hello,

  After selecting the table name in the combo box, submit the form to
same page. Then check the condition like...

<%
  if request.servervariables("HTTP_METHOD")="POST" 'or GET
    ...
   'retrieve all the data from the table

  end if
%>

If this is not your requirements, let me know


---------
Rajani



 
Old October 1st, 2004, 09:30 PM
Friend of Wrox
 
Join Date: Jan 2004
Posts: 1,870
Thanks: 12
Thanked 20 Times in 20 Posts
Send a message via AIM to mat41
Default

Mazimi,

You have the bombo box as a reply to your other post?
http://p2p.wrox.com/topic.asp?TOPIC_ID=20029

To create this list all you need is an onChange event in the <select> tag. When a user makes a selection from the combo box it runs the onChange event, submits it's self then reloads the page creating the list.

1..Change your select tag to include:
<select name="userList" onChange="Javascript:updateForm.submit();">

2..Now put a condition up top somewhere, has the form been submited? if so it will run otherwise be ingorned
<%
   Dim showlist
   showList = false
   if request.form("userList") <> "" then
      'get all records where not = combo box selection
      sql = "SELECT id, UniqueName, F_NAme, L_Name, MI FROM tUser WHERE id <> " & request.form("userList") & ";"
      set getInfo = conn.execute(sql)
      'create show list variable
      showList = true
   end if

3..Now where ever in the body of your page you want to see the list; you say:
;;;names should be shown in the check boxes
I dont understand this part. I only know of one type of checkbox, you cant put a names in them.
Q..Do you want check boxes adjacent to each name?

Anyhow, to show your list

<% if not getInfo.EoF then
        response.write "<table>"
        do until getInfo.EoF
           response.write "<tR><td>" & getInfo(2) & "</td><td>&nbsp;</td><td>" & getInfo(3) & "</td></tr>"
           getInfo.moveNext
        loop
        response.write "</table>"
     else
        'do nothing
     end if
%>

this will give you a list in a table each row being' F_NAme' space 'L_Name'. If you want a checkbox adjacent to each name, throw a checkbox tag in the loop just before getInfo(2)






Wind is your friend
Matt
 
Old October 1st, 2004, 09:34 PM
Friend of Wrox
 
Join Date: Jan 2004
Posts: 1,870
Thanks: 12
Thanked 20 Times in 20 Posts
Send a message via AIM to mat41
Default

quick correction to the above post:

change this:
<% if not getInfo.EoF then
        response.write "<table>"
        do until getInfo.EoF
           response.write "<tR><td>" & getInfo(2) & "</td><td>&nbsp;</td><td>" & getInfo(3) & "</td></tr>"
           getInfo.moveNext
        loop
        response.write "</table>"
     else
        'do nothing
     end if
%>

To this:

<% if showList = true then
     if not getInfo.EoF then
        response.write "<table>"
        do until getInfo.EoF
           response.write "<tR><td>" & getInfo(2) & "</td><td>&nbsp;</td><td>" & getInfo(3) & "</td></tr>"
           getInfo.moveNext
        loop
        response.write "</table>"
     else
        'do nothing
     end if
  end if
%>



Wind is your friend
Matt
 
Old October 4th, 2004, 03:18 PM
Registered User
 
Join Date: Sep 2004
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks a lot for your help.
Regards & Thanks
:)
Azimi






Similar Threads
Thread Thread Starter Forum Replies Last Post
check box help? dstein4d Access VBA 2 February 27th, 2008 09:54 AM
Check BOx kaushikpulpa ASP.NET 2.0 Professional 2 August 30th, 2007 08:01 AM
setting combox box value to href in <link> bhairraju CSS Cascading Style Sheets 2 March 23rd, 2007 01:58 PM
List Box or Combox Dahuan60 VB How-To 4 February 25th, 2005 09:02 AM
Search using drop down list box and a text box tcasp Classic ASP Basics 1 July 31st, 2003 02:58 PM





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