|
FF is not in my requirements but still I tested on it and to my surprise, it is not populating it at all, and a strange thing is that it is accepting only alphabets and not sensing keys like backspace, tab etc.
This is happening only for the controls which are inside grid. I have one textbox which is outside the grid and it is getting autopopulated properly with its list. The second bug (i.e.: Enter first character and then select from the list by mouse") exists also for this control though. For this textbox, I have array as
"var fopArray = ['CHECK','CASH'];". Here, I have a js validation function fired onblur event of textbox which checks whether anything else than these values are typed in and shows alert accordingly. So when I type 'C' and clicks on any of the populated values from the above list, the value don't get selected and onblur gets fired and my alert messages shows up.
Wondering for the reasons.
|
|
|
|
|
...yes, and after the errors happen - did you go to Tools -> Error Console -> Errors? There should be the description of error, can you look at it please?
Listen up! "Teamwork" means staying out of my way! (Seifer, Final Fantasy 8).
|
|
|
|
|
Error: dgTraveler.rows[i].childNodes[0].firstChild is null
Source File: http://localhost:3722/QuickBooking.aspx
Line: 168
|
|
|
|
|
guravman wrote: Error: dgTraveler.rows[i].childNodes[0].firstChild is null
So the problem is in the grid - you're referencing the cell that has no firstChild .
Listen up! "Teamwork" means staying out of my way! (Seifer, Final Fantasy 8).
|
|
|
|
|
But why not in IE then? I can debug javascript function from Visual Studio 2008 and when I applied breakpoint, it shown me IDs for all the iterations.
|
|
|
|
|
Hi Dmitry,
Regarding above issue. One more scenario I got which prooves that it does happen when AJAX call happens. The scenario is as below:
I have once link button on the page and one textbox which autopopulates using autoSuggest.js.
On my link button click, I update text of that button using AJAX. For this, I have one updatepanel around the link button and the textbox is outside this panel. Now, when I click my linkbutton, the text gets updated but then autosuggest textbox starts skipping the entries. However, if I put my textbox also inside update panel, on click of the lnkbutton, it behaves perfectly fine.
Do this scenario give any clue?
Thanks,
Mangesh
|
|
|
|
|
|
Hi,
I've been able to find - after many experiments - a similar issue with skipping entries; it will be fixed in the future release. Meanwhile, can you please give me your e-mail (or just e-mail me to dmitrykhudorozhkov@yahoo.com) so I can sent you a new version to test?
Regards,
Dmitriy.
Listen up! "Teamwork" means staying out of my way! (Seifer, Final Fantasy 8).
|
|
|
|
|
|
A few issues on IE7+:
1. Using this.use_scroll = true; in FF3 works OK, but in IE7, when mouse clicking on the scroll bar, the result list closes.
* Is there some simple fix?
2. In IE7, Start and End keys work both for setting the cursor to the beggining/end of the input and at the same time also for moving to the first/last row in the list.
In FF3, Start and End keys are only good for moving within the list, but not in the textbox.
* Is it possible to replicate IE behaviour in FF3 or at least have the same behaviour in both?
3. When resizing the page with open list, IE7 positions OK, but FF3 moves the list to some position other than under the textbox.
* Is it fixable?
Hint: this does not happens in zichun version Auto-complete Control[^]
4. Suggestion: add version number to the script, so people will know if some comment applies to their versions or not.
Regards
|
|
|
|
|
I am using the value/key method to use the auto-suggest control. I populate them from an SQL Server database. The values I use are "category name", "categoryID".
I post my form to a "results.asp" page. I retrieve the value field by using - Request("txtSearch")
This gives me "category name", however what I really need is the "categoryID" so I can pass it to my SQL query to return the search results.
Because I am not very good at javascript I am not sure what code I should use to retrieve both the "key/value" pairs or just the "key".
Any help would be greatly appreciated.
|
|
|
|
|
|
hello Dmitry
I would like to create a form to retrieve a postal code.
In this form there is 2 fields :
- CityName
- PostalCode
I made an autocomplete field for Cityname, and it works fine. My aim is to auto fill the PostalCode when the user pick up a cityname in the autocomplete cityname list. Any idea how to implement that ?
Thank you for any advice.
Nicolas
|
|
|
|
|
You could put the Cityname and PostalCode in the value, using a separator as semicolon or another. "Cityname1;PostalCode1", "Cityname2;PostalCode2", "Cityname3;PostalCode3", &c.
You will have to split the value later with javascript.
Regards
|
|
|
|
|
I have over 200 items in the list.
Typing gra gets these results -
Aa Gradient
Ascites Albumin Gradient
Kilogram <==> Pound
Transtubular Potassium Gradient
However, if I now clear the search box (clicking backspace repeatedly) and type single character a
The results are -
Aa Gradient
Ascites Albumin Gradient
Kilogram <==> Pound
Transtubular Potassium Gradient
ABG
Acute Lung Injury Ratio
Age from DOB
Allergy-Immunology
Alveolar Gas Equation
As you can see the results from the earlier search are appearing first.
Can you please help?
Sanjay Khandkar
|
|
|
|
|
Hi Sanjay,
I'll look over this issue today, thank you for reporting.
Listen up! "Teamwork" means staying out of my way! (Seifer, Final Fantasy 8).
|
|
|
|
|
ChooserMethod:
when 1, choose all that start with what's entered. h -> honda, hyundai
when 2, choose all that enclosed (strstr in C) what's entered. h -> honda, hyundai, lamborghini
when 3, like 1 if only 1 character entered, like 2 if more that one are entered.
Item 3 could be configurable for character count that triggers behavior.
|
|
|
|
|
I think it is already implemented:
this.limit_start = false; // should the auto complete be limited to the beginning of keyword?
If NOT what you needed, let us know.
If this IS what you need, next time please RTM!
Bye
|
|
|
|
|
<asp:textbox id="employees_m" runat="server" visible="true" cssclass="INPUTBOX" autopostback="true">
new autosuggest("employees_m", employees_m);
If I input "Alain" and then I select "Alain Trepanier" from the list I only get "Alain" in employees_m.Text in this code behind function:
Private Sub employees_m_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles employees_m.TextChanged
End Sub
How to get the value ?
BTW great article! We will donate.
PS: If you can, I'd like more details for the cases using AJAX i.e. your solution two. Now I inject javascript variable from Code behind.
|
|
|
|
|
Hi,
I'm not quite proficient in ASP.NET, but autopostback seems a bad practice here.
What I can say: maybe you should create an additional autopostback input field (id="employees_addon") write:
new autosuggest("employees_m", employees_m, "", function(index, control)
{
document.getElementById("employees_addon").value = control.values[index];
});
?
AlainTrepanier wrote: PS: If you can, I'd like more details for the cases using AJAX i.e. your solution two. Now I inject javascript variable from Code behind.
You'll need a simple webservice, that accepts a textstring (start of keyword entered), and outputs a text string (see article). Any problems here?
Hope it helps,
Dmitriy.
Listen up! "Teamwork" means staying out of my way! (Seifer, Final Fantasy 8).
|
|
|
|
|
Here is my solution:
'In the page:
<asp:textbox id="employeeTxb_m" runat="server" visible="true" cssclass="INPUTBOX" autopostback="false">
new autosuggest("employeeTxb_m", employees_m, "", function(index, control){__doPostBack('employeeTxb_m',control.values[index]);});
' Code Behind (Sorry that this code is in VB.net):
Private Sub em(ByVal sender As Object, ByVal e As System.EventArgs) Handles employeeTxb_m.TextChanged
Dim empId As Integer = CInt(Request.Params("__EVENTARGUMENT"))
End Sub
'In Page_Load is have this block that is executet each time
' Register employee list javascript variable
Dim sb As StringBuilder = New StringBuilder()
sb.Append("")
sb.Append("var employees_m = [")
For Each dr As DataRow In allEmployeesLookupDt_m.Rows
sb.Append(String.Format("['{0}',{1}],", CStr(dr("EmpName")).Replace("'", "\'"), dr("EmpNo")))
Next
sb.Append("];")
sb.Append("")
Page.ClientScript.RegisterClientScriptBlock(Me.GetType(), "employeesList_m", sb.ToString().Replace("],];", "]];"))
|
|
|
|
|
Lots of changes have happened in the past few months and looking through the questions this topic has been outdated. Currently, how are we supposed to get the value from a key/value array?
I'm using this at the moment, but it only works the first time something is selected. If you go and erase the text and type something else it doesn't get me the value anymore.
<pre>
<input type='hidden' value="" name="reviewStation">
<input type='text' class="newField" onchange="document.getElementById('reviewStation').value = obj_station.values[0];" style="align:left; width:245px;" value="" name="revStationShow">
<script> var obj_station = new autosuggest("revStationShow", stations_array); </script>
</pre>
Any suggestions? Let me know if you need more clarification.
|
|
|
|
|
Hi,
to get a key:
var key = obj_station.keywords[obj_station.selectedIndex];
to get a value:
var value = obj_station.values[obj_station.selectedIndex];
Hope it helps,
Dmitriy.
Listen up! "Teamwork" means staying out of my way! (Seifer, Final Fantasy 8).
|
|
|
|
|
Perfect! Thank you.
I also chose to modify it a bit. In case anyone wants to see, my code is below:
<input type='hidden' value="<% if toUpdate then %><%= rS1("StationID") %><% end if %>" name="reviewStation">
<input type='text' class="newField" style="align:left; width:245px;" value="" name="revStationShow">
<script>
var obj_station = new autosuggest("revStationShow", stations_array, null, function(index, control)
{
document.getElementById('reviewStation').value = control.values[index];
}
);
</script>
|
|
|
|
|
My implementation uses ajax to retrieve the results, BUT the data is hold in static client-side arrays:
After retrieving the results from database with Ajax, I create the array passing the result and using eval.
This way I can have dinamic list (ajax) of options (autosuggest) with no delay in searches (client-side).
I thought it might be useful to someone else.
|
|
|
|