|
First of all - good work. You've got my 5 points and vote.
Some suggestions though for future releases:
1. It would be better to make global variable suggesturl the actb public property.
It will be very useful for multiple controls on the same page.
2. In real life we very often are getting the user friendly input from GUI, but inside the application are using codes. In the case of select element it is simple with the value attribute. It would be very useful to have similar option in your control too.
3. It is the advantage of your control that it is pure Javascript and doesn't use the AJAX libraries, cumbersome as every common thing. But it will be the additional advantage, if you'll convert it to server control. It will not loose it's run time simplicity, but will be much more comfortable in definition and distribution.
For me the point 2 is the most important. I cannot use your control without it, and unfortunately I have no time just now to do it myself.
Thanks.
Regards,
Gennady
|
|
|
|
|
Hi Gennady,
Gennady Oster wrote: First of all - good work. You've got my 5 points and vote.
Thanks a lot!
Gennady Oster wrote: 1. It would be better to make global variable suggesturl the actb public property.
Will do it.
Gennady Oster wrote: 2. In real life we very often are getting the user friendly input from GUI, but inside the application are using codes. In the case of select element it is simple with the value attribute. It would be very useful to have similar option in your control too.
Will do it also in the next update (Sept. 20th)
Gennady Oster wrote: 3. It is the advantage of your control that it is pure Javascript and doesn't use the AJAX libraries, cumbersome as every common thing. But it will be the additional advantage, if you'll convert it to server control. It will not loose it's run time simplicity, but will be much more comfortable in definition and distribution.
It will be done, but in a (near) future. I'm learning ASP.NET intensively, so let's hope I'll come to it. But - I won't "convert", but create a separate package with a ASP.NET control.
Best regards,
- Dmitry.
-------------------------
Listen up! "Teamwork" means staying out of my way! (Seifer, Final Fantasy 8).
|
|
|
|
|
Hi !
Dmitry Khudorozhkov wrote: Will do it also in the next update (Sept. 20th)
OK, thanks, shall wait it impatiently.
Dmitry Khudorozhkov wrote: But - I won't "convert"
Sure, "convert" is figuratively.
Don't forget to include the style attributes in the public properties of the control.
And BTW, may be it has sense to add the Css class property to actb object, as alternative (not substitute) to the multiple style attributes.
Regards,
Gennady
|
|
|
|
|
Gennady Oster wrote: 2. In real life we very often are getting the user friendly input from GUI, but inside the application are using codes. In the case of select element it is simple with the value attribute. It would be very useful to have similar option in your control too.
Can you please explain what exactly do you mean? Current version already has a switch (actb_useScroll ) that converts it to auto-suggest combo-box.
Or do I miss something?
Best regards,
- Dmitry.
-------------------------
Listen up! "Teamwork" means staying out of my way! (Seifer, Final Fantasy 8).
|
|
|
|
|
I mean that there has to be hidden item containing the code of the selected value.
For example, user selects the country name from the list of countries, but submit passes to the application the country code, not name. With select it is simple:
<select name="countries" size="5" id="countries"><br />
<option value="1" SELECTED>Russia</option><br />
<option value="2">USA</option><br />
<option value="3">Israel</option><br />
<option value="4">Great Britain</option><br />
<option value="5">France</option><br />
<option value="6">Italy</option><br />
</select>
May be I simply didn't understand how to do the same thing with auto-suggest control ?
And BTW, I had to add the following line to constructor:
ca = ca || '';
Without it, the script fails on ca.length, when using the new with the single parameter.
Regards,
Gennady
|
|
|
|
|
Now I understand. There are 2 solutions:
1:
- Add a public property value to the actb object;
- together with the suggestion variants, supply an additional list of values:
var custom_array = new Array(['abracadabra', 1], ['apple', 2], ['alligator', 3], ...); that are assigned to the value property once the appropriate variant is selected.
2:
- Add a public property selectedIndex ;
- not changing the format of custom_array , determine the index of the selected item and assign the selectedIndex to it.
Is that what you want?
Gennady Oster wrote: And BTW, I had to add the following line to constructor:
Thanks for taking a note, I'll look at this.
Best regards,
- Dmitry.
-------------------------
Listen up! "Teamwork" means staying out of my way! (Seifer, Final Fantasy 8).
|
|
|
|
|
Dmitry Khudorozhkov wrote: Add a public property selectedIndex
OK.
Dmitry Khudorozhkov wrote: Add a public property value to the actb object
There is no need. We have already the public property actb_keywords.
So instead of
obj.actb_keywords = tmpinfo.split('|');
will be
obj.actb_keywords = tmpinfo.split('|');<br />
for (var ii=0;ii < obj.actb_keywords;ii++)<br />
{<br />
obj.actb_keywords[ii] = obj.actb_keywords[ii].split(',');<br />
}
And in all further operations with
actb_keywords[i]
use
actb_keywords[i][0] .
I can (and shall) do it myself, but I want to adjust it with you, in order not to rewrite application for new versions of your control.
Regards,
Gennady
|
|
|
|
|
Got it.
BTW, we already have the selectedIndex - it is the actb_pos property. Maybe I'll rename some variables to be more clear and consistent.
-------------------------
Listen up! "Teamwork" means staying out of my way! (Seifer, Final Fantasy 8).
|
|
|
|
|
OK. I'll wait for new version.
May be you'll also change the requirements for suggesturl? Let it be as complex as user needs:
Instead of
http.open("GET", suggesturl + "?str=" + ot_, true);
use
http.open("GET", suggesturl + ot_, true);
So user can add other parameters.
Regards,
Gennady
|
|
|
|
|
This article happened to participate in CodeProject's Monthly Programming Competition, ASP.NET section.
If you find this article useful, of just wish to express gratitude to the author, please vote for it here:
http://www.codeproject.com/script/survey/survey.asp?survey=721
Thank you very much in advance!
- Dmitry Khudorozhkov, author of the Auto-suggest control.
-------------------------
Listen up! "Teamwork" means staying out of my way! (Seifer, Final Fantasy 8).
|
|
|
|
|
Third update will be ready by September 20th of this year. it will include a frequently-asked feature of no-default-suggestion (optional), more comments throughout the code, and some other minor improvements.
- Dmitry.
-------------------------
Listen up! "Teamwork" means staying out of my way! (Seifer, Final Fantasy 8).
|
|
|
|
|
Good job and keep up the good work
|
|
|
|
|
Thanks a lot
-------------------------
Listen up! "Teamwork" means staying out of my way! (Seifer, Final Fantasy 8).
|
|
|
|
|
Due to big number of article response, update of the article is delayed till September 10th of this year. It will bring several much asked features and article update.
Best regards,
- Dmitry.
-------------------------
Listen up! "Teamwork" means staying out of my way! (Seifer, Final Fantasy 8).
|
|
|
|
|
|
2nd upgrade of the auto-suggest script will include:
- ability to use a standard scrollbar instead of up/down "buttons" (optional, on by default);
- fix for the MS IE bug, when suggestion list was rendered behind page controls (optional, off by default);
- other minor improvements.
Update will be sent to CodeProject administrators in several hours.
- Dmitry.
-------------------------
Listen up! "Teamwork" means staying out of my way! (Seifer, Final Fantasy 8).
|
|
|
|
|
have you fixed the stuff explained in the thread "Having no default suggestion"?
thats a big problem for me right now..
Thanks again
|
|
|
|
|
This is still pending. I'll come with the solution soon.
Best regards,
- Dmitry.
-------------------------
Listen up! "Teamwork" means staying out of my way! (Seifer, Final Fantasy 8).
|
|
|
|
|
hi!
I'm using the control with values in hebrew and it work's great.
The only problem I have is that I need it to be right align because that hebrew is a right to left language.
I have a very basic knowledge in JavaScript so can you please help me by
explaining how to align the auto-suggest to right?
thank's
Itai
|
|
|
|
|
Hi! You should do the following:
1. Inside actb_generate function, find the code:
...
r.id = 'tat_tr_' + this.actb_base_id + j;
var c = r.insertCell(-1);
c.style.color = this.actb_textColor;
c.style.fontFamily = this.actb_fFamily;
...
2. After c 's declaration, add:
c.align = "right";
So you'll get:
...
r.id = 'tat_tr_' + this.actb_base_id + j;
var c = r.insertCell(-1);
c.align = "right";
c.style.color = this.actb_textColor;
c.style.fontFamily = this.actb_fFamily;
...
Hope it helps,
- Dmitry.
-------------------------
Listen up! "Teamwork" means staying out of my way! (Seifer, Final Fantasy 8).
|
|
|
|
|
|
No problem Could you please vote for the article? Every vote matters, you know
BTW, I recommend that you wait a bit until new version arrives (I've sent it to CP 8 hours ago).
-------------------------
Listen up! "Teamwork" means staying out of my way! (Seifer, Final Fantasy 8).
|
|
|
|
|
Just received an e-mail from CodeProject editor - article update is queued, we are 16th in a queue
-------------------------
Listen up! "Teamwork" means staying out of my way! (Seifer, Final Fantasy 8).
|
|
|
|
|
Article was updated. Enjoy
-------------------------
Listen up! "Teamwork" means staying out of my way! (Seifer, Final Fantasy 8).
|
|
|
|
|
Updated to the newer release (thanks!) and the script broke in my environment. When instantiating a new copy of actb, the first argument is now just 'tb' rather than document.getElementById('tb'). A good fix, but the article above should be updated to reflect it.
Dave
|
|
|
|