getting focus on draggable form

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
User avatar
kendall
Forum Regular
Posts: 852
Joined: Tue Jul 30, 2002 10:21 am
Location: Trinidad, West Indies
Contact:

getting focus on draggable form

Post by kendall »

Hi,

I have a div tag which i have made into a draggable object. in this div tag i have loaded a html form. However what i shappening is that the form input elements are not receiving focus when trying to input data.

Is there anything that I can do to give focus precedence to the input form over the div?
User avatar
ghurtado
Forum Contributor
Posts: 334
Joined: Wed Jul 23, 2008 12:19 pm

Re: getting focus on draggable form

Post by ghurtado »

Did you try anything like this? ...

Code: Select all

document.getElementById('formfield').focus() 
User avatar
kendall
Forum Regular
Posts: 852
Joined: Tue Jul 30, 2002 10:21 am
Location: Trinidad, West Indies
Contact:

Re: getting focus on draggable form

Post by kendall »

ghurtado wrote:Did you try anything like this? ...

Code: Select all

document.getElementById('formfield').focus() 
yeah...but because its draggable the focus is being lost i think...i'm trying to see if i can switch it on/off
User avatar
jayshields
DevNet Resident
Posts: 1912
Joined: Mon Aug 22, 2005 12:11 pm
Location: Leeds/Manchester, England

Re: getting focus on draggable form

Post by jayshields »

Whatever mechanism you've got for dragging stuff around, make it store whatever has focus before the dragging, and then set whichever element had focus before to have it again after the dragging has finished?
User avatar
kendall
Forum Regular
Posts: 852
Joined: Tue Jul 30, 2002 10:21 am
Location: Trinidad, West Indies
Contact:

Re: getting focus on draggable form

Post by kendall »

jayshields wrote:Whatever mechanism you've got for dragging stuff around, make it store whatever has focus before the dragging, and then set whichever element had focus before to have it again after the dragging has finished?
and thats the thing...

what i find strange is that i have links within the div that i am able to click on....However, the input elements are being "loaded" (AJAX) in on an onclick....I tried using onLoad to set a focus but If the user were to try and use the mouse rather than the "tab" the focus is lost.

i'm re-evaluating using the drag....
Post Reply