Am in Salesforce (visualforce) and using custom javascript autocomplete. My requirement is to initiate an automatic full search in the text field element2as soon as a choice is made from offers in another text field element1.
Since I need to scroll through the list of auto offers using the keyboard, I need to focus on a specific field. I am currently doing it element2.focus()right after selecting on element1and starting the search for automatic search on element2.
In addition, in these fields, when the search is performed and the user manually focuses on the field, the automatic offer crashes - this is a sign of the search being canceled. Because of this, I cannot start the search and then callelement2.focus()
Here is what I see in different browsers:
Chrome / Firefox 3.5, 4 / Safari 5.0.3:
- Select an option from the offers in
element1 - Value in field change
- Collapse offers
- The field is blurred, but not sure where the focus is directed. Probably,
window
IE 8: 1. Select an option from the suggestions in section element1
2. Importance in field changes 3. Suggestions collapse 4. Blur fields and element2focus 5. Search for fires for this field
, - . (/, ) . javascript- , .
"", , element2.focus() , , 100 , setTimeout(). , , element1 onblur element2.focus(), .
, - ?
:
function handleMouseClick(event){
element1.value = (event.target)?event.target.textContent:event.srcElement.innerText;
callback();
hideAutoComplete();
}
function callback() {
element2.value = '';
element2.focus();
}