473,657 Members | 2,559 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Navigating qucikly to my text in Drop-Down - Classic ASP

Hi,

I couldnt locate a Classic ASP group hence posting here.

One of my colleagues has designed an intranet site and one of the pages
has a drop-down box with close to 300 options. I want to navigate to
the desired option quickly just by typing out the name. For example if
I want to choose "Other" (All the options are arranged alhabetically
within the Drop-down box) from Drop-down and if I Type "O" then I
navigate to first entry with letter "O" but if I follow it up quickly
with "T" then jump to entry with first letter as "T".

What technique to use so that one can type O, then T, then H and be
able to quickly navigate to Entry with first three letters as "OTH"

Please guide me.

Regards,
Hari
India

Nov 19 '05 #1
3 3190
i found that code a long time ago and add it an hebrew support
it is in javascript so it can be used in .net too

add the script in the head
<script language="JavaS cript" src="includes/combo.js"></script>
////////////////// IE4+ ComboBox Script -- (C) 1999 by Ralph L. Brown
(akakEk) ////////////////////
var UNDEFINED; // do not assign!
function getX(obj)
{
return( obj.offsetParen t==null ? obj.offsetLeft :
obj.offsetLeft+ getX(obj.offset Parent) );
}

function getY(obj)
{
return( obj.offsetParen t==null ? obj.offsetTop :
obj.offsetTop+g etY(obj.offsetP arent) );
}

function isvalidchar(ach ar,validstr)
{
return(
validstr.toUppe rCase().indexOf (achar.toString ().toUpperCase( ),0) >= 0
);
}
function onSelectFocus( objSelect, flgInput )
{
if ( document.layers ) // NS4 (which doesn't work for SELECT objects
anyway)
{
//document.captur eEvents( Event.KEYPRESS | Event.KEYDOWN |
Event.KEYUP );
//document.onkeyd own = selectKeyDownHa ndler;
//document.onkeyp ress = selectKeyPressH andler;
//document.onkeyu p = null;
}
else if ( document.all ) // IE4
{

if ( !document.all.d ivComboBubble ) // if this is the first time
this function is called
{ // then create the bubble text
window (<DIV>).
document.body.i nsertAdjacentHT ML("beforeEnd" ,
"<DIV id='divComboBub ble'
style='position :absolute;top:0 px;left:0px;vis ibility:hidden' ></div>");
}

// create/init data elements

objSelect.X = getX(objSelect) +2;
objSelect.Y = getY(objSelect)-20;
objSelect.strKe yInBuf = '';
objSelect.flgIn put = false;

// if flgInput is 'INPUT' then this is an enterable list box.
if ( flgInput != UNDEFINED )
{
objSelect.flgIn put = ( (''+flgInput).t oUpperCase() == 'INPUT' );
}
// setup event handlers
objSelect.onmou seover = selectMouseOver Handler;
objSelect.onmou seout = selectMouseOutH andler;
objSelect.onblu r = selectBlurHandl er;
objSelect.onkey down = selectKeyDownHa ndler;
objSelect.onkey press = selectKeyPressH andler;
objSelect.onkey up = null;
// display bubble help (title)
//objSelect.onmou seover(window.e vent); // this should work, but in
early versions of IE4 it doesn't!
selectMouseOver Handler(window. event);
}
}
function BubbleText(objS elect)
{
var s = divComboBubble. innerHTML = '';

if ( !objSelect ) // for the onBlur event to clear out the bubble
help
{
return(false);
}

with ( objSelect )
{
if ( strKeyInBuf.len gth > 0 )
{
if ( strKeyInBuf == title )
{
s = '<FONT color="blue">' + strKeyInBuf + '</font>';
}
else if ( ( selectedIndex >= 0 ) && ( strKeyInBuf ==
options[selectedIndex].text ) ) // unique match found
{
s = '<B>' + strKeyInBuf + '</b>';
}
else
{
var c =
strKeyInBuf.sub string(strKeyIn Buf.length-1,strKeyInBuf.l ength);
c = ( c == ' ' ) ? '&nbsp;' : '<B>' + c + '</b>';
s = strKeyInBuf.sub string(0,strKey InBuf.length-1) + c;
}

divComboBubble. innerHTML = '<TABLE cellpadding=0 cellspacing=0
style="backgrou nd-color:INFOBACKG ROUND;'
+ 'font:8pt ms sans serif;padding:2 px 2px 2px
2px;color:INFOT EXT;border:1px solid INFOTEXT">'
+ '<TR><TD align=left><NOB R>'+s+'</nobr></td></tr></table>';
}

divComboBubble. style.posLeft = X;
divComboBubble. style.posTop = Y;
divComboBubble. style.visibilit y = '';
}

return(true);
}
function findSelectEntry ( objSelect, head, tail ) // uses
divide-and-conquer search, assumes sorted list
{
with ( objSelect )
{
if ( options.length <= 0 )
{
strKeyInBuf = ' <FONT color="red">No selections available.</font>
';
BubbleText( objSelect );
window.status = strKeyInBuf = '';
return(-1);
}

if ( strKeyInBuf == '' )
{
strKeyInBuf = title;
BubbleText( objSelect );
window.status = strKeyInBuf = '';
selectedIndex=0 ; // set to top
return( selectedIndex = options[selectedIndex].text.length ? -1 :
0 );
}

var mid = Math.round( (head+tail)/2 );

if ( strKeyInBuf.toU pperCase() ==
options[mid].text.substring (0,strKeyInBuf. length).toUpper Case() )
{
while ( (mid>0) && strKeyInBuf.toU pperCase() ==
options[mid-1].text.substring (0,strKeyInBuf. length).toUpper Case() )
{
mid--; // get the topmost matching item in the list, not just
the first found
}

selectedIndex=m id;

window.status = strKeyInBuf =
options[mid].text.substring (0,strKeyInBuf. length);

if ( mid == Math.round( (head+tail)/2 ) ) // if the original mid
is an exact match
{
if ( (mid==tail) || ( (mid<tail) && strKeyInBuf.toU pperCase()
!= options[mid+1].text.substring (0,strKeyInBuf. length).toUpper Case() )
)
{
window.status = strKeyInBuf = options[mid].text; // unique
match found
}
}

BubbleText( objSelect );

return( selectedIndex );
}

if ( head >= tail ) // then since no exact match was found, go back
to previous strKeyInBuf (thus the length-1)
{
strKeyInBuf = strKeyInBuf.sub string(0,strKey InBuf.length-1)
return( findSelectEntry ( objSelect, 0, options.length-1 ) );
}

if ( strKeyInBuf.toU pperCase() <
options[mid].text.substring (0,strKeyInBuf. length).toUpper Case() )
{
return( findSelectEntry ( objSelect, head, Math.max(head,m id-1) )
);
}

return( findSelectEntry ( objSelect, Math.min(mid+1, tail), tail ) );
}
}
function selectMouseOver Handler(e)
{
var event = e ? e : window.event; // to handle both NS4 and IE4
events

if ( event.srcElemen t.strKeyInBuf == '' )
{
event.srcElemen t.strKeyInBuf = event.srcElemen t.title;
BubbleText( event.srcElemen t );
event.srcElemen t.strKeyInBuf = '';
}
else
{
BubbleText( event.srcElemen t );
}

return(true);
}
function selectMouseOutH andler(e)
{
var event = e ? e : window.event; // to handle both NS4 and IE4
events

if ( event.srcElemen t != document.active Element )
{
BubbleText( event.srcElemen t );
}

return(true);
}
function selectBlurHandl er(e)
{
var event = e ? e : window.event; // to handle both NS4 and IE4
events

event.srcElemen t.strKeyInBuf = '';
window.status = (event.srcEleme nt.selectedInde x>=0) ?
event.srcElemen t.options[event.srcElemen t.selectedIndex].text : '';
BubbleText( event.srcElemen t );

return(true);
}
function selectKeyDownHa ndler(e)
{
var event = e ? e : window.event; // to handle both NS4 and IE4
events

with ( event.srcElemen t )
{
// this is to correct the search bug when the list is left open
after single-click
if ( ( strKeyInBuf == '' ) && ( event.keyCode > 40 ) )
{
event.srcElemen t.blur();
event.srcElemen t.focus();
}

switch(event.ke yCode)
{
case(8): // backspace
{
if ( ( selectedIndex >= 0 ) && ( strKeyInBuf ==
options[selectedIndex].text ) && !event.srcEleme nt.flgInput )
{
window.status = strKeyInBuf = '';
}
else
{
window.status = strKeyInBuf =
strKeyInBuf.sub string(0,strKey InBuf.length-1);
}

BubbleText( event.srcElemen t );
event.keyCode = 0;
return(false);
}

case(9): // tab
case(13): // enter
{
event.keyCode = 9; // convert enter to tab
return(true);
}

case(27): // escape
{
window.status = strKeyInBuf = '';
BubbleText( event.srcElemen t );
event.keyCode = 0;
return(false);
}

case(32): // space
{
window.status = strKeyInBuf += ' ';
// this must be fired explicitely for spaces
return( event.srcElemen t.flgInput ? event.srcElemen t.flgInput :
selectKeyPressH andler(event) );
}

// I don't know if these are universal
case(33): // page up
case(34): // page down
case(35): // end
case(36): // home
case(38): // up arrow
case(40): // down arrow
{
window.status = strKeyInBuf = '';
BubbleText( event.srcElemen t );
return(true);
}

} // end switch
} // end with

return(true);
}
function selectKeyPressH andler(e)
{
var event = e ? e : window.event; // to handle both NS4 and IE4
events

if ( event.keyCode == 13 ) { event.srcElemen t.blur();
event.srcElemen t.focus(); }

if (
isvalidchar(Str ing.fromCharCod e(event.keyCode ),"אבגדהו זחטיכלמ *סעפצקרש תףךץןםABC DEFGHIJKLMNOPQR STUVWXYZ0123456 789
`~!@#$%^&*()_-+={}[]|:;'<>,./?\\\"" ) )
{
event.srcElemen t.strKeyInBuf +=
String.fromChar Code(event.keyC ode);
}
if ( event.srcElemen t.flgInput ) // this is an enterable field
{
event.srcElemen t.options.lengt h = 0;
event.srcElemen t.strKeyInBuf =
event.srcElemen t.strKeyInBuf.s ubstring(0,31); // maxlength=32, should
be set elsewhere
event.srcElemen t.options[0] = new Option(
event.srcElemen t.strKeyInBuf, event.srcElemen t.strKeyInBuf );
event.srcElemen t.selectedIndex = 0;
}
else // search to find the matching value
{
// must use setTimeout to override the default SELECT keypress
event(s)
var strSel = 'document.' + event.srcElemen t.form.name + '.' +
event.srcElemen t.name;
setTimeout( 'findSelectEntr y(' + strSel + ',0,' + strSel +
'.options.lengt h-1);' , 1 );
}

return(true);
}
////////////////////////////////// -- End ComboBox.js --
////////////////////////////////////////

and the select option tag should look like this
<select name='article_m agazine_id' onFocus='onSele ctFocus(this)'
title='magazine ' >
<option ............... ............
....
....
</select>


ex********@yaho o.com wrote:
Hi,

I couldnt locate a Classic ASP group hence posting here.

One of my colleagues has designed an intranet site and one of the pages
has a drop-down box with close to 300 options. I want to navigate to
the desired option quickly just by typing out the name. For example if
I want to choose "Other" (All the options are arranged alhabetically
within the Drop-down box) from Drop-down and if I Type "O" then I
navigate to first entry with letter "O" but if I follow it up quickly
with "T" then jump to entry with first letter as "T".

What technique to use so that one can type O, then T, then H and be
able to quickly navigate to Entry with first three letters as "OTH"

Please guide me.

Regards,
Hari
India


Nov 19 '05 #2
Stan,
Try microsoft.publi c.inetserver.as p.general I looked up the group posting statistics and it seemed to be a dead
group (with only 3/4 messages).

Regards,
Hari
India

Usenet Honey Pot wrote: ex********@yaho o.com wrote in news:1130218017 .022573.15680
@o13g2000cwo.go oglegroups.com:
Hi,

I couldnt locate a Classic ASP group hence posting here.

Did you even look? : )

Try microsoft.publi c.inetserver.as p.general

--
Stan Kee (sp**********@r ogers.com)


Nov 19 '05 #3
Tetitu,

Thanks for the code.

Would get back in case my colleague has problems in implementing the
same.

Regards,
Har
India
i found that code a long time ago and add it an hebrew support
it is in javascript so it can be used in .net too


Nov 19 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
3264
by: skip | last post by:
A simple script like the one below lets me jump through a directory structure. However, if I run it from /this/directory and within it to go to /a/totally/different/directory... I'm still actually going to be in /this/directory when I exit the script. Is it possible to have a script that can drop me off into a different directory than where I initiated it from? import os process = 1 while (process):
17
4201
by: Danny J. Lesandrini | last post by:
The following code works with a standard MDB to navigate to a particluar record (with a DAO recordset, of course) but it's giving me problems in an ADP I'm working on. Dim rs As ADODB.Recordset Set rs = Me.RecordsetClone rs.Find "=" & lngContractID If Not rs.EOF Then Me.Bookmark = rs.Bookmark I must site the Heisenberb Uncertainty Principal here, as it
2
3345
by: zee | last post by:
HELP! Hi, I really need help navigating between pages in my web application. When I press a button I want to go to a particular page in my Visual Studio .net application. Plase help Thank you in advance Zee
5
7415
by: Roy Lawson | last post by:
I am having no problems connecting to a DB, creating a DataAdapter, and creating a dataset...and connecting to the data. Using the builtin data objects to do all this. My only problem now is navigating through the data. I can get the data into a datagrid without any problems, but I want the data to show up in textboxes and use some sort of move next, move previous, move last, etc (like in VB6) command to navigate the data (using...
1
3445
by: JohnMOsborn | last post by:
I am designing an Access database that will use tab controls. Normally, you place different sets of fields on each page of the tab control like Fields1-3 on Page 1, Fields 4-6 on Page 2, etc. In my database, however, I want to associate a particular numbered record of a field with each separate tab. In exploring my options, it looks like the best way to do this is to add a record-navigating On Click event to each separate page of the...
10
1803
by: arnuld | last post by:
i have created a programme that prints the elements of an array. programme is compiled without ant trouble but i am getting some strange outputs: ------------------- PROGRAMME -------------------------- #include <iostream> void print_array(char ar) { std::cout << "printing elements:";
0
1425
by: Ohad Weiss | last post by:
Hi all, I've once asked about that topic. but didn't get an answer. I have a dataset based on 4 tables, which have relation between them. The main table presented to the user on textboxes placed on the form, and the rest of the tables presented on textboxes placed on tabpages (tabpage for each table). Here is the code I use:
0
1165
by: Ohad Weiss | last post by:
Hi I have a problem with two textboxes binded to a dataset, based on paren table, and table for the child records. I can navigate between the master records (and of course the child records are changed according to the datarelation), but when I try to add a new record, and then try to navigate between master records, the child records are noot changing. Does anyone have a solution?
0
1908
by: in10se | last post by:
I have a .NET 2.0 application that uses the WebBrowser control. Because all of my pages are generated dynamically, I am catching the Navigating event, cancelling it, and performing my own operations based on the Uri that is passed in the WebBrowserNavigatingEventArgs.Url property. If the page is requesting an external URL, I would like to open the page in a new browser window. When requesting an external page, the URL is of the form:...
2
1739
tuxalot
by: tuxalot | last post by:
Strange occurrence and I've looked everywhere and can't seem to find any explanation. Using A07, when I navigate records using the built-in buttons, the text in my labels darkens increasingly while navigating forward/backward. When I change tabs, all returns to normal. Ever heard of this? It only occurs for labels on tabs 3-9. Would love to find a solution. Thanks, Tux
0
8825
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8732
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8503
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8605
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6163
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupr who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5632
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4151
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4302
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2726
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.