Xpages typeahead and focus issue

Hi,I am building some xpages web applications but am having issues with field focus.

I cannot add focus to an editable field that has the typeahead function enabled.

document.getElementById(theField).focus() or similar does not work.

any ideas?

Subject: Id of the field

Have you checked in the resulting HTML displayed on the web that the ID of the typeahead field is in fact the same as you give as argument for the ‘document.getElementById()’ call ?

Type Ahead out of the box in XPages is achieved through Dojo, which adds a bit of html code wrapped around the actual field you want to focus.

If you give your field the ID “myFieldId” in the Designer, the field will end up with an ID similar to this on the web “view:_id30:_id42:_id189:myFieldId”

Subject: checked the id

Thanks for your response. To get the id of the field I am using the suggestion I got off here in this post

http://www-10.lotus.com/ldd/nd85forum.nsf/5f27803bba85d8e285256bf10054620d/7f9911addf9aa95a8525762d00741aac?OpenDocument

This should get the id of the field correctly I think.

This works fine, until you add typeahead to the field you are trying to give focus.

Subject: .

Can’t you check (with Firebug or similar tools) if the ID parameters are identical for the type-ahead field itself and in the script block?

I had no problems setting the focus to a type ahead field on my XPage, so there must be a mismatch with the IDs…

Subject: solved

Thanks for pointing me in the right direction…

Another point I found was that for Internet explorer (not just for xpages) you may need to call focus twice to work. dont ask me why