Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
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 January 2nd, 2005, 12:24 AM
Friend of Wrox
 
Join Date: Jun 2003
Location: , NY, USA.
Posts: 141
Thanks: 1
Thanked 0 Times in 0 Posts
Default Combining more than one letter in List Box

Hi All,

I am not sure if it is possible to search for a value in the
"LIST BOX" by combining more than one letter.

For example: I have a "List Box" of companies.
One of the companies is "IBM".
When I press the letter "I", it jumps the first company that starts with letter the "I". What I am trying to achieve is to get to
"IBM" by pressing the letters "I, B and M" on the List Box.
Right now, if you press "I" and then "B", it jumps to the first company that starts with the letter "B", which is the default setup.

Thanks for you help.

mcinar

__________________
MCinar

Love all the creatures because of the creator.
 
Old January 2nd, 2005, 08:33 AM
Imar's Avatar
Wrox Author
Points: 70,322, Level: 100
Points: 70,322, Level: 100 Points: 70,322, Level: 100 Points: 70,322, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Hi mcinar,

Unfortunately, this is not possible with the default drop-down available in today's browsers. However, there are third party controls available that emulate this behavior with JavaScript. For instance check out the Web FX Combobox:

http://webfx.eae.net/dhtml/combobox/combobox.htm

Cheers,

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
While typing this post, I was listening to: There Is a Kingdom by Nick Cave & the Bad Seeds (Track 5 from the album: The Boatman's Call) What's This?
 
Old January 2nd, 2005, 10:36 AM
Friend of Wrox
 
Join Date: Jun 2003
Location: , NY, USA.
Posts: 141
Thanks: 1
Thanked 0 Times in 0 Posts
Default

Hi Imar,

Thank you for your help.

Have a healthy and happy new year,

mcinar.

 
Old January 17th, 2005, 01:24 PM
Friend of Wrox
 
Join Date: Jun 2003
Location: , NY, USA.
Posts: 141
Thanks: 1
Thanked 0 Times in 0 Posts
Default

Hi Imar,

I was wondering if there is "VBSCRIPT" version of this tool.

Thanks for your help,

MCinar


 
Old January 17th, 2005, 04:00 PM
Imar's Avatar
Wrox Author
Points: 70,322, Level: 100
Points: 70,322, Level: 100 Points: 70,322, Level: 100 Points: 70,322, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

I don't think so.

It also seems the page / product is no longer under development, so I doubt there will we a VBScript version in the future.

Why do you need a VBScript version?

Cheers,

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
 
Old January 17th, 2005, 10:54 PM
Friend of Wrox
 
Join Date: Jun 2003
Location: , NY, USA.
Posts: 141
Thanks: 1
Thanked 0 Times in 0 Posts
Default

Hi Imar,

I am not an expert in JavaScript and I am more comfortable with VBScript.

I am currently populating the combo box with the data from SQL Table. Here is my VBScript code;

<%
sub display_member_company%>
    <div id="membercompany" style="position:absolute; width:600px; z-index:11; left:10px; top: 50px;">
        <form name="frmMemberCompany" id="frmMemberCompany" action="update_billing.asp" method="POST">
            <input type="hidden" name=Corp_ID value="<%=lngCorpID%>">
            <input type="hidden" name=Update_Type value="<%=strUpdateType%>">
            <table class="tdleft" align="center" width="100%" border="3" RULES="NONE" cellpadding="2" cellspacing="0">
                <tr>
                    <td class=td2 style="background-color:#000099; color=#FFFFFF;">MEMBER COMPANY:</td>
                    <td><img src="images/spacer.gif" width="2" height="1" border="0" alt="">
                    <td> <% call display_corp_list() %> </td>
                    <td><img src="images/spacer.gif" width="2" height="1" border="0" alt="">
                    <td><input style="cursor:hand;" type="submit" name="btnGO" value="GO"></td>
                </tr>
            </table>
        </form>
    </div>
<%end sub%>


<%sub display_corp_list()
    dim cn, rsCorp, strSQL, rsCorp2

    set cn = server.CreateObject("adodb.connection")
    cn.Open strConn

    strSQL = "sp_sel_uncancelled_corporations"

    set rsCorp = cn.execute(strSQL)

    response.write "<select name='sltCorp' id='sltCorp'>"

    if lngCorpID = 0 then

        response.write "<option value='0'>" & "--- Select Member Company ---" & "</option>"
        do while not rsCorp.eof
            Response.Write "<option value=""" & rsCorp("corp_id") & """>" & format_from_db(rsCorp("corp_name")) & "</option>"
            rsCorp.movenext
        loop
    else
        ' Get the CORP NAME
        strSQL = "sp_ParmSel_CorpByCorpID @CorpID = " & lngCorpID

        set rsCorp2 = cn.execute(strSQL)
        if not rsCorp2.eof then
            strCorpName = format_from_db(rsCorp2("corp_name"))
        end if

        set rsCorp2 = nothing

        do while not rsCorp.eof
            if clng(lngCorpID) = rsCorp("corp_id") then
                ' Response.Write "<option value=""" & lngCorpID & """>" & format_from_db(rsCorp("corp_name")) & "</option>"
                Response.Write "<option value=""" & lngCorpID & """>" & strCorpName & "</option>"
            ' else
            ' Response.Write "<option value=""" & rsCorp("corp_id") & """>" & format_from_db(rsCorp("corp_name")) & "</option>"
            end if
            rsCorp.movenext
        loop

        ' Get the rest of the corp list
        rsCorp.movefirst
        do while not rsCorp.eof
            if clng(lngCorpID) <> rsCorp("corp_id") then
                Response.Write "<option value=""" & rsCorp("corp_id") & """>" & format_from_db(rsCorp("corp_name")) & "</option>"
            end if
            rsCorp.movenext
        loop
    end if

    response.write "</select>"

    set cn = nothing
    set rsCorp = nothing
    set rsCorp2 = nothing
end sub%>

I am not sure how I can achieve the same result with the Combo box tool that you recommend.

Thanks for your help,

MCinar

 
Old January 18th, 2005, 10:43 PM
Friend of Wrox
 
Join Date: Jun 2003
Location: , NY, USA.
Posts: 141
Thanks: 1
Thanked 0 Times in 0 Posts
Default

Hi Imar,

I would like to know if it is possible to share a memory variable between VBSCRIPT and JAVASCRIPT.
Let's say;
In JavaScript:
function validatedata()
{
var strFrm = document.frmCompany;
}

In VBScript function, can I access "strFrm" variable?

Thanks for your help,

MCinar

 
Old January 24th, 2005, 03:26 PM
Imar's Avatar
Wrox Author
Points: 70,322, Level: 100
Points: 70,322, Level: 100 Points: 70,322, Level: 100 Points: 70,322, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Hi there,

I am sorry I didn't respond earlier. Somehow I overlooked this thread.

Anyway, check out this thread: http://p2p.wrox.com/topic.asp?TOPIC_ID=11765

It provides information about "sharing" client and server side variables.

Cheers,

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
While typing this post, I was listening to: Aqueous Transmission by Incubus (Track 13 from the album: Morning View) What's This?
 
Old January 24th, 2005, 10:45 PM
Friend of Wrox
 
Join Date: Jun 2003
Location: , NY, USA.
Posts: 141
Thanks: 1
Thanked 0 Times in 0 Posts
Default

Hi Imar,
As always, you have been very helpful.

Have a nice day,


MCinar

Love all the creatures because of the creator.
 
Old January 26th, 2005, 12:26 AM
Friend of Wrox
 
Join Date: Jun 2003
Location: , NY, USA.
Posts: 141
Thanks: 1
Thanked 0 Times in 0 Posts
Default

Hi Imar,

I have a question regarding to
the "Web FX Combo Box" that you recommend earlier:

I tested and it works well with a small amount of data, but I have a corporation table with 1,4016 records. When I try to use the Combo Box with this table, the Combo Box is very slow to populate the data and when you scroll and pick another record, it freezes.

* I also try to use <DIV> tag to specify different location to display the "Combo Box", it didn't work.

Here is my code with a small table of 11 records. You won't be able to run it, but you can take a look at the code;

<%@ Language=VBScript %>
<% option explicit %>


<html>
<head>
    <title></title>
</head>

<body>
    <script src="ComboBox.js"></script>

    <script language="javascript">
        var varLocName, varLocID;

        <%
            dim cn, rs, strSQL, strCorpName, lngCorpID, strlocName, lngLocID

            // strSQL = "sp_sel_uncancelled_corporations"
            strSQL = "select loc_id, loc_code, loc_name from location order by sort_order"

            set cn = server.createobject("ADODB.Connection")
            cn.open strConn

            set rs = cn.execute(strSQL)

            ' set cn = nothing
            ' set rs = nothing

            %>
            dm=new ComboBox("dm")

            <%
            while not rs.eof
                strLocName = rs("loc_name")
                strLocName = left(strLocName,1) & Replace(trim(strLocName), "~", "`", 2)
                strLocName = Replace(strLocName, "^^", " ")

                lngLocID = rs("loc_id")
                %>
                varLocName = '<%=strLocName%>';
                varLocID = '<%=lngLocID%>';
                dm.add(
                 new ComboBoxItem(varLocName, varLocID)
                )
                <%
                rs.movenext
            wend

            set cn = nothing
            set rs = nothing
            %>
    </script>
</body>
</html>


Thanks for your help,



MCinar

Love all the creatures because of the creator.




Similar Threads
Thread Thread Starter Forum Replies Last Post
Grab Values From List Box into Text Box phungleon VB How-To 2 June 19th, 2008 10:33 PM
check/letter box ,submit button grazian7 ASP.NET 2.0 Professional 0 November 30th, 2007 11:15 AM
multi-column list box values moved to 2nd list box sbmvr Access VBA 1 May 14th, 2007 01:58 PM
Populate List Box by Combo Box Selection mmcdonal Access 2 June 15th, 2004 12:08 PM
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.