Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Nasir on Jul 11, 2008 01:48
open dhtmlx forum
dhtmlxcombo focus

Hi,

i'm using dhtmlxcombo in autocomplete filter mode from the server as a search box. therefore, i want to add the functionality that the user gets the text back in the combobox he/she had previously enterd in the combobox before hitting the submit button.

i use the getComboText() function to store the string user enterd and the setComboText() function to place the string back in to the combobox when the user returns to this page. This all works great however, i want to automatically set the focus to the combobox once the user returns to the page. even this works well with the DOMelem_input.focus() method.

There is only a slightly little problem and that is when the focus is set, it sets the cursor back BEFORE the string and not AFTER the string. If it would set the cursor after the string it would automatically open the autocomplete list again which would be great and user friendly not to forget.

however i cannot get this last part to work. could you plese help me out with this?

regards,

Nasir
Answer posted by Support on Jul 11, 2008 02:55
This is native behavior of IE, it can't be changed.
The best which can be done - part of entered text can be preselected

combo.setComboText(text);
combo.DOMelem_input.focus();
dhtmlXRange(combo.DOMelem_input,text.length,text.length+1);
Answer posted by Nasir on Jul 11, 2008 03:12

Hi,

i have achieved tthis effect rather simply.

first set the focus on the combobox and then call the setComboText() function

perform this in this respective order and it seems to work.. at least in my case.

thanx for your reply!