|
Hi Ben,
please use the following code to receive the index of currently selected item:
for(var i=0,c=0,len=actb_obj.actb_keywords.length; i<len;>{
if(actb_obj.actb_bool[i]) c++;
if(c == pos)
{
return (actb_obj.actb_values[i][1] || 'n/a')
}
}
where actb_obj is the actb object
Regards,
Dmitry.
Listen up! "Teamwork" means staying out of my way! (Seifer, Final Fantasy 8).
|
|
|
|
|
Thanx for the article and code ...it is really gr8...
BTW i'm added this code in my project but i'm not getting the image if i set actb_useScroll=false.I have kept the image in the same folder as the script.
|
|
|
|
|
Hi - experiencing a problem with the location of the autosuggest div.
When using the code on a page that has a scrollbar, if you slightly scroll down the parent page, and then try to use the autosuggest, the div does not appear under the appropriate text box - sometimes it's over the text box completely so you can't continue typing in your query.
Any help would be appreciated.
|
|
|
|
|
Hi Andrew,
can you please send me the test page where I can see this problem?
Thank you in advance,
Dmitry.
Listen up! "Teamwork" means staying out of my way! (Seifer, Final Fantasy 8).
|
|
|
|
|
Hi does any body know how to change the font color from black to white when moving over the list....I have customized the code and applied the hcolor to purple so now the characters in side cannot be seen...so when i move over the options the color of the character should change to white for visibility...if any one has idea plz reply ....its very very urgent....
Thanks in advance
Ashu
|
|
|
|
|
Hi ,
Thanks for your control, i have a problem in using ur control im using the beta control , when im selecting a name from the drop down list for the first time it's working fine , from the second time on when try to select the name from the drop down list using mouse when ever i presses mouse button , the dropdown is closing without completing the operation , the dropdown list is closing in mouse down event , it's working fine in IE7.
Thanks in advance!!!!!!!!
|
|
|
|
|
Good evening,
can you please give a little more info:
- does the bundled sample work ok for you?
- do you use client-side array or a web-service?
- what version of FF you're using?
Regards,
Dmitry.
Listen up! "Teamwork" means staying out of my way! (Seifer, Final Fantasy 8).
|
|
|
|
|
Thanks for your Reply
Ya , it's working fine in IE7 ,
i need to test my application in firefox 2 also , it's giving problem in firefox2 , i didn't checked in firefox 3.
im using client side array only!!!!
Regards,
PV
modified on Monday, September 8, 2008 12:49 AM
|
|
|
|
|
Dmitry, first at all, excelent piece of code, it works smoothly, you're a lifesaver. I have a similar issue in FF3 and Safari 3.1: it´s not possible to select an item by clicking on it (even from the first time in my case). This is the code I have:
<br />
<div id="lyrFastSearch" style="width:250px; height:100px; background-color:White; border:solid 1px blue; padding-right:3px; padding-left:5px; padding-top:5px; padding-bottom:5px; position:absolute; left:20px; top:20px" ><br />
<div style="width:100%; color:Blue; cursor:move; text-align:right; font-size:9px;"><div style="cursor:hand; cursor:pointer; text-align:right; margin-right:0px; width:35px;" onclick="$('tb').value = ''; ">Close</div></div><br />
<font style="font-size:9px">Tip: Start typing to see options.</font><br />
<input type="text" id="tb" value="" style="font-family:verdana;width:96%; padding-right:3px; font-size:12px" rel="" /><br />
<script type="text/javascript"> new autosuggest("tb", namesList, null, function(index, control) { AddSelectedToCaller($('tb').attributes.rel.value, control.keywords[index], control.values[index]); }); </script><br />
</div>
The AddSelectedToCaller function take the selected item and place it inside a sortable list container (and it only works by using the keyboard arrows)
Thanks in advance.
"Master Control Program: Your user can't help you now, my little program! " (Tron, 1982)
|
|
|
|
|
Hi,
1. Did you try the latest release of the script?
2. After mouse selection fails - are there any errors shown in Firefox's error console?
3. Is the page in question on the net so I can look at it? If it is not for public - can you please send the URL to my e-mail (dmitrykhudorozhkov@yahoo.com)?
Regards,
Dmitriy.
Listen up! "Teamwork" means staying out of my way! (Seifer, Final Fantasy 8).
|
|
|
|
|
Hi Dmitry. Thanks for your time on this.
1. Yes, I did.
2. No error is shown in FF error console
3. Ouch!.. Sorry, by this time, this is an internal development (as an extreme measure, I´ll find out the way to publish it).
I found that the function AddSelectedToCaller as defined in new autosuggest("tb", namesList, null, function(index, control) { AddSelectedToCaller($('tb').attributes.rel.value, control.keywords[index], control.values[index]); }); is not being called (as mentioned, it is called only when keyboard is used)
Also, I´m using $('tb').attributes.rel.value to have a reference to the control which required to show, with particular info, the autosuggest (of course, before of this, I set the 'rel' value of the 'tb' control).
By the way, the JS parameters I´m using are:
this.time_out = 0; <br />
this.response_time = 100; <br />
this.entry_limit = 10; <br />
<br />
this.limit_start = false; <br />
this.match_first = true; <br />
this.restrict_typing = true; <br />
this.full_refresh = false; <br />
<br />
this.use_iframe = true; <br />
this.use_scroll = true; <br />
this.use_mouse = true; <br />
this.no_default = true; <br />
this.start_check = 0; <br />
<br />
this.text_delimiter = [";", ","]; <br />
this.ajax_delimiter = "|"; <br />
this.item_delimiter = ","; <br />
this.selectedIndex = -1;<br />
and finally, I´m using a Javascript array to load the options, for example:
var namesList = [['Bruce Dickinson', '245|1'],['Adrian Smith', '246|1']] (Yes, the identifiers need to come in the 'X|Y' format and yes, it´s loaded via asp.net in runtime)
Well, I hope this information can be enough for you.
Thanks again and regards.
"Master Control Program: Your user can't help you now, my little program! " (Tron, 1982)
|
|
|
|
|
Sorry to keep bothering you..
When using an external script to generate XML data for the data population, your article states that the required format is:
<listdata>item1,value1|item2,value2|...what if the item or value has a comma in it?
I replaced all commas with their ascii equivelant (,), which works fine when displaying the suggest list, but once one is selected and moved to the text box, the ascii value is shown, so that's no good.
Any suggestions?
|
|
|
|
|
patrick mcgovern wrote: When using an external script to generate XML data for the data population, your article states that the required format is...
You can easily change this. Look at the line 1071 of autosuggest.js (I think it is the line; for reference, it is:
var ca = obj.actb_keywords[i], comma = ca.indexOf(",");
If you change it to:
var ca = obj.actb_keywords[i], comma = ca.indexOf(";");
you can have ; symbol to delimit key and value (you'll have to make changes to your server script and/or XML, of course).
- Dmitry.
Listen up! "Teamwork" means staying out of my way! (Seifer, Final Fantasy 8).
|
|
|
|
|
that's not in the script - should I be using the beta version?
|
|
|
|
|
"Stable" doesn't support key/value pairs at all, so you can safely use commas in items (I think).
My previous comment was related to the "beta" release, yes.
P.S. Sorry for inconvenience - "beta" is quite mature, so you're quite safe to use it.
Listen up! "Teamwork" means staying out of my way! (Seifer, Final Fantasy 8).
|
|
|
|
|
Ok
I'm using beta now, and made the change you suggested.
Some, not all, of the entries in the list show both item and value, while others only show item.
The ones that show item and value are displayed like this:
AEROTECH;AEROTECH
For the sake of sanity, here is the full list generated for the xml doc:
<listdata>AENON CONSULTANTS, LTD;AENON|AEROTECH;AEROTECH|ALTERNATIVES IN ENGINEERING, INC.;ALTERNATI|APACHE JUNCTION LANDFILL;APACHE|APPLIED ENGINEERING SERVICES, LTD;APPLIEDEN|ARC DESIGN RESOURCES, INC.;ARC|ARCHAEOLOGICAL RESEARCH, INC.;ARCHAEOLO|AUTOMATED PLATTING INC.;AUTOMATED|BROWN DESIGN GROUP;BDG|C.S. DRILLING INC.;CSDRILL|CAPITAL ENGINEERING;CAPITALEN|CARDINAL STRUCTURAL DESIGN, INC.;CARDINALS|CARTER & BURGESS;CB|CHRISTOPHER BURKE ENGINEERING, LTD;CHRISENG|CLARK DIETZ, INC;CLARKDIET|COOPER AERIAL SURVEYS CO.;COOPER|CRAWFORD, MURPHY &TILLY, INC.;CRAWFORD|DESIERTO VERDE;DESIERTO|DEWBERRY & DAVIS LLC;DEWBERRY|ECO-ENGINEERING SOLUTIONS, LLC;EES|ENCAP, INC;ENCAP|ENGINEERING AND ENVIRONMENTAL;ENGENV|ENVIRONMENTAL SCIENCE CORP.;ESC|GEO-TECHNOLOGIES, INC.;GEOTECH|GEOCON CONSULTANTS, INC.;GEOCON|GEWALT HAMILTON ASSOC., INC.;GEWALT|GRUMMAN BUTKUS ASSOCIATES;GBA|H.H. HOLMES TESTING LAB., INC.;HHHOLMES|HAEGER ENGINEERING LLC;HAEGER|HEY AND ASSOCIATES INC.;HEYASSOC|HIGHLAND ENGINEERING;HIGHLANDE|HINES IRRIGATION CONSULTANTS, INC.;HINES|HUFF & HUFF, INC.;HUFF|INNERSPACE ENVIRONMENTAL ASSESSMENT;INNERSPAC|JFNEW;JFNEW|KEELEY CONSTRUCTION, INC.;KEELEY|KENIG, LINDGREN,O'HARA, ABOONA, INC;KENIGLEND|KUDRNA & ASSOCIATES, LTD;KUDRNA|LAND STRATGIES, INC.;LANDSTRAT|LANDSCAPE ARCHITECTS;LANDSCAPE|LSC TRANSPORTATION CONSULTANTS, INC;LSC|LUMOS AND ASSOCIATES, INC.;LUMOS|METRO TRANSPORTATION GROUP, INC.;METROTRAN|MILLER BROOKS ENVIRONMENTAL, INC.;MBE|PAUL R. GLENN ARCHITECTS, INC.;PAULRGLEN|PROFESSIONAL SERVICE INDUSTRIES, IN;PSI|R2T INC.;R2T|SABNEKAR CONSULTING, LLC;SABNEKAR|SEWER SYSTEM EVALUATIONS, INC.;SSE|SOLAEGUI ENGINEERS;SOLAEGUI|SPECIALIZED SERVICES COMPANY;SSC|SPENCER B. GROSS, INC.;SPENCER|STREET SMARTS;STREETSMA|STRUCTURES UNLIMITED, P.C.;STRUCTURE|STS CONSULTANTS, LTD;STS|TASK ENGINEERING CO INC;TASKENGIN|TERRACON CONSULTANTS INC;TERRACON|TIERRA ECOLOGICAL CONSULTANTS;TIERRAECO|TOBEY-WADE CONSULTING;TOBEY|TRANSPORTATION STRATEGIES, LTD;TRANSPORT|YELLOW JACKET DRILLING;YELLOW|
|
|
|
|
|
My bad. You should change not only the line
var ca = obj.actb_keywords[i], comma = ca.indexOf(",");
, but also the line which is 3 lines below it:
var ci = ca.split(',');
(change comma to semicolon)
- Dmitry.
Listen up! "Teamwork" means staying out of my way! (Seifer, Final Fantasy 8).
|
|
|
|
|
Perfect! Thanks Dmitri
|
|
|
|
|
in using Firefox, the autosuggest works perfectly.
IE however, does absolutely nothing.
When using in IE 6, placing a window alert within the main actb function, yields nothing.
(Firefox displays this, as well as alert(http.responseText);, suggested in an earlier post)
If I place the alert above the function (under the 'var image' code) I see the alert.
The code within the parent page I am using to initiate the actb class is as follows:
new actb('bst_db_consultant_idx', '', 'req_subConsultantAutoLoadList.php?page=contractsproposals&subpage=request&');
The XML created by req_subConsultantAutoLoadList.php is valid.
Where am I going wrong?
|
|
|
|
|
Hi,
1) Do you place the "new actb(..." statement after the bound INPUT element has loaded? (you should place the SCRIPT element after the INPUT, or in the BODY's onload handler)?
2) Does MS IE show any errors in the status bar?
- Dmitry.
Listen up! "Teamwork" means staying out of my way! (Seifer, Final Fantasy 8).
|
|
|
|
|
1) The js code "new actb(..." is placed after the input.
2) There are no javascript errors show in IE, as well as no errors or warnings displayed in firebug (firefox)
|
|
|
|
|
Strange. Does the sample that is bundled with article work for you in MS IE?
By the way - where exactly you place the 'alert' in the body of actb? I'd suggest placing them in several places of the constructor function to see if the actb object gets correctly initialized.
- Dmitry.
Listen up! "Teamwork" means staying out of my way! (Seifer, Final Fantasy 8).
|
|
|
|
|
I will try the sample and respond.
I placed the alert is multiple places and in IE it only works if it is placed above the construct function.
Also - Thank you so much for responding as quickly as you have - it is truly appreciated.
|
|
|
|
|
Yes - the example code works fine in IE
|
|
|
|
|
patrick mcgovern wrote: Yes - the example code works fine in IE
Then there are 2 ways to debug this:
1. Try to put "new actb (..." statements not in the HTML code, but in the onload handler of BODY element.
2. In autosuggest.js, place alerts in "actb" function in every gap (i.e. between code blocks - you'll see), so you can see if any one fires.
(I believe the very 1st alert - placed right after the "function actb(...){" statement should fire - because there is surely nothing erroneous)
- Dmitry.
Listen up! "Teamwork" means staying out of my way! (Seifer, Final Fantasy 8).
|
|
|
|
|