|
FINALLY, you detected the problem that I had. I am also using xhtml and can't change to html.
When using xhtml the mouse doesn't work properly in IE.
Thanks and I'll be looking forward the xhtml-compatible version of the script
Best Regards
|
|
|
|
|
Hi,
I have generated a simple php file that generates the following xml file:
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<listdata>Canada|USA|United Kingdom</listdata>
The php file is as follows:
<?php
$host = "xxxx";
$database = "xxxx";
$user = "xxxx";
$password = "xxxx";
mysql_connect($host,$user,$password);
mysql_select_db($database);
$sql = "SELECT name FROM Creditor WHERE fk_client_id = 1";
$rs = mysql_query($sql);
header('Content-Type: application/xml;');
echo "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\" ?>\n";
?>
<listdata>
Canada|USA|United Kingdom
</listdata>
The autosuggest is invoked as follows:
<label class="block"><span>Crediteur</span><input type="text" name="inputcrediteur" id="inputcrediteur" size="35"/></label>
<script>
var obj = new autosuggest("inputcrediteur", "", "/retrieve_creddeb.php?");
</script>
When I run the page and start typing in the input box, it shows an error on line 1259 saying that this.keywords.0 is null or not an object. Firebug shows that the this.keywords variables are 'undefined'.
I am quite new to all this, so I am assuming I am overlooking something extremely trivial. I would very much appreciate anyone's help in this.
By the way, the autosuggest functionality does work when I use it based on arrays.
Thanks in advance,
Ronald.
|
|
|
|
|
Good evening,
this is a very strange bug - right now I'm trying to debug the issue.
As a quick solution, I can recommend you to set the full_refresh variable to true - this will allow the code to skip the problematic line.
Best regards,
Dmitriy.
Listen up! "Teamwork" means staying out of my way! (Seifer, Final Fantasy 8).
|
|
|
|
|
Found.
There is a bug in the code. The block:
if(comma != -1)
{
var ci = ca.split(that.item_delimiter);
that.keywords[i] = that.keywords_init[i] = ci[0];
that.values[i] = that.values_init[i] = ci[1];
}
else
{
that.values[i] = that.values_init[i] = "";
}
should be:
if(comma != -1)
{
var ci = ca.split(that.item_delimiter);
that.keywords[i] = that.keywords_init[i] = ci[0];
that.values[i] = that.values_init[i] = ci[1];
}
else
{
that.keywords[i] = that.keywords_init[i] = ca;
that.values[i] = that.values_init[i] = "";
}
Sorry for this.
Listen up! "Teamwork" means staying out of my way! (Seifer, Final Fantasy 8).
|
|
|
|
|
Works! Many thanks indeed for your extremely quick reply!
Best regards,
Ronald.
|
|
|
|
|
Hi Dmitry !
Glad to see that you continue to support your "child", and it justly became very popular.
Nevertheless two notes.
One - minor bug: the name of the variable use_IFrame is used with different case, so it always works as false.
Second - suggestion. May be it has sense to add to the autosuggest object one more property - id. Say, this.id=this.field_id + '_actd' . It may be useful when you have several autosuggest objects and want to use the single OnSelect function.
Regards,
Gennady
My English is permanently under construction. Be patient !!
|
|
|
|
|
Forgot one more suggestion, that as far as I remember, I've already suggested in the past.
So the thead may be called "Three things"
I'm speaking about styling. It would be much more convenient,
if the suggestions style will be in the external css.
And leave the default style inline.
Regards,
Gennady
My English is permanently under construction. Be patient !!
|
|
|
|
|
Good evening,
On your notes:
1. Thank you for pointing on the use_IFrame - will fix it in next release (next week).
2. You can use a single OnSelect now too - just define it as a separate named function:
function onSelect(control, index)
{
...
}
and use it wil any number of autosuggest objects:
new autosuggest("field1", custom_array_2, null, onSelect);
new autosuggest("field2", custom_array_2, null, onSelect);
...
If you still need to access the autosuggest object, you can do it through the input field it is bound to:
document.getElementById("field1").autosuggest
3. CSS for styles is high on my work list - will be done for the next release.
Best regards,
Dmitriy.
Listen up! "Teamwork" means staying out of my way! (Seifer, Final Fantasy 8).
|
|
|
|
|
Hi Dmitry!
Think, I didn't explain clear enough my question concerning control ID. It is needed not to get access to the control, but in the first place - to recognize control. For instance:
function ItemSelected(index, control) {
switch (control.id)
{
case 'BRANCH_CODE_ACTB':
CleanDependentDDL('ROVA_CODE_ACTB');
<......>
return;
break;
case 'ROVA_CODE_ACTB':
CleanDependentDDL('AREA_CODE_ACTB');
<......>
return;
break;
}
}
I know that I can use control.field_id property, but to consistency and readability of the program it would be better not to use "indirection".
Regards,
Gennady
My English is permanently under construction. Be patient !!
|
|
|
|
|
Hi Dmitry,
Testing the "restrict list" feature I noticed that if I typed certain characters (2nd Letter) that were not part of the word in the list, then the list disappeared. For instance if my list contained "apple", and I type "a", "apple" would appear. If I then type "s" then the restrict is somehow bypassed and "apple" disappears. It only does it with some letters - and changes depending on what word is in the list. It also does it whether the 2nd letter type is not in the entire word or another word in the list. Strange? IE and chrome.
Regards
Collin
Ok did some more checking if the JS script is set to "autocomplete to beginning of word", the restrict script does not take this into account. It will only restrict typing based on what is in the entire array. That is why you can type a second letter even if does not appear in the list because that letter combination might appear elsewhere in the array.
modified on Saturday, August 15, 2009 7:45 PM
|
|
|
|
|
Hi,
seems like a bug; I'll try to take care of it till the next release (early next week, I hope).
Regards,
Dmitriy.
Listen up! "Teamwork" means staying out of my way! (Seifer, Final Fantasy 8).
|
|
|
|
|
Hi Dmitry,
Thanks for all your hard work on improving the code.
Just a question for some thought.
I have an array which is produced from a DB. I have managed to incorporate this autosuggest quite well and was wondering if there are any limitations in the code for the length or size of the array.
For instance when I create an array from my DB recordset the autosuggest seems to stop working after 117 comma separated array. I can echo the entire array onto the page so its not a server side issue. It (autosuggest)just seems to stop after a certain length.
Regards
Collin
|
|
|
|
|
Good morning,
there is no limitation on the length of the client-side array; I have successfully tested the script with arrays with 6000 (six thousand) records and it worked ok.
Problems usually arise because of incorrect escaping (any quotes in the records?). If something stops working - are there any errors shown in Firefox's error console?
Best regards,
Dmitriy.
Listen up! "Teamwork" means staying out of my way! (Seifer, Final Fantasy 8).
|
|
|
|
|
Dmitry,
Thanks for the reply,
After investigating the record data in the array I did find traces of characters that corrupt the string. The only ones that corrupt the array were (single quotation) ' and \ (back slash). Surprisingly a comma , or double quotation " had no effect.
This would probably mean I need to cleanse my data on data entry.?
Regards
Collin
|
|
|
|
|
kernel1969 wrote: This would probably mean I need to cleanse my data on data entry.?
Maybe (or maybe not). All this means that in the end (when you output the array to the page) you must output the correct Javascript array. It doesn't matter if you clean the data at the data entry or escape/cleanse it when building output.
Hope it helps,
Dmitriy.
Listen up! "Teamwork" means staying out of my way! (Seifer, Final Fantasy 8).
|
|
|
|
|
|
Hi,
I have 3 autosuggest textboxs:
text1,text2,text3.
I need that if text1 or text2 was populated then text3 is enabled
and if both of them was erased text3 will be disable again.
I have tried the following code:
Event.observe('locationText', 'onkeydown', onKeyDownPress);
Event.observe('britText', 'onkeydown', onKeyDownPress);
function onKeyDownPress(event) {
var element = event.element();
var textLength = element.value.length;
if (textLength == 0) {
byLocationFlag = 0;
$('KMText').disabled = "disabled";
}
if (textLength > 0) {
byLocationFlag = 1;
$('KMText').disabled = '';
}
}
but when I select by going down on the list (with keyboard arrows) the event is not happenning.
what I did wrong?
|
|
|
|
|
hi When i am using this code only pre defined data is showing. I want to use asp textbox as input and array from my database. How can i do this.
waiting for your ans.
thanks
|
|
|
|
|
I get my suggestion list ok but I don't have the arrows up and down.
If you have an idea why it is happening.
Tali
|
|
|
|
|
Hi,
if you don't have the arrows - then you should have the scrollbar, I guess.
The mode (scrollbar or arrows) is controlled by use_scroll member variable of autosuggest object.
Regards,
Dmitriy.
Listen up! "Teamwork" means staying out of my way! (Seifer, Final Fantasy 8).
|
|
|
|
|
Hi Dmitry
I also have this problem.
With use_scroll = false;
The up/down arrows are nolonger displayed ?
was okay when using prev. version with CSS built in and not external.
Regards
Phil
|
|
|
|
|
|
I've been e-mailed about this issue recently; this is somehow related to inner sorting.
I'm just back from the vacation - will try to sort out the issues by weekend.
- Dmitriy.
Listen up! "Teamwork" means staying out of my way! (Seifer, Final Fantasy 8).
|
|
|
|
|
This will be fixed in the next release. The fix is:
1. Find the code:
suggest: function(ot, t)
{
if(ot.length < this.start_check) return;
var al = this.keywords.length;
this.total = 0, this.rebuild = false;
if(!this.field.value.length)
{
this.total = al;
for(var i = 0; i < al; i++)
{
this.keywords[i] = this.keywords_init[i];
this.values[i] = this.values_init[i];
this.bool[i] = true;
}
}
...
Change it to:
suggest: function(ot, t)
{
if(ot.length < this.start_check) return;
var al = this.keywords.length;
this.total = 0, this.rebuild = false;
for(var i = 0; i < al; i++)
{
this.keywords[i] = this.keywords_init[i];
this.values[i] = this.values_init[i];
this.bool[i] = true;
}
if(!this.field.value.length)
{
this.total = al;
}
...
Regards,
Dmitriy.
Listen up! "Teamwork" means staying out of my way! (Seifer, Final Fantasy 8).
|
|
|
|
|
Thanks, I'm using the new version now.
Regards
|
|
|
|