• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Passing data to specific textbox

 
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,

i have a page having a two frame...
the upper main frame has a form page having 7 to 8 text boxes
and the bottom frame has keyboard.

i want to do following steps:

when i type from keyboard which is at bottom frame the input goes to the
text box of main frame were the cursor was placed.

it works successfully for only one text box which i get the text box by id for input.

But i want input goes to the text box having cursor position because the page from the main frame is changed.
 
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sounds like you need to figure out how to pass the id of the textbox to your function when a new textox is focused.

Play with this:
onfocus="alert(this.id);"

Eric
 
Ratan Pawar
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sir, i read about onfocus by this we can get id or name of element.
but i want to use touchscreen.whatever i type it goes in the field which is active.(i am using firebox).
 
Eric Pascarello
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
So you now can get the id. You store that in a variable. You refernce that variable in your bottom frame and set the "virtual keyboard" value into that textbox.

Without knowing how the keyboard is setting the value I can guess something like this:

Top Frame


Bottom Frame


Eric
 
Ratan Pawar
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes Sir,
i did it and it also working.
but sir is it possible,as i write a separate js file in which i find the element which has focus.
instead i give attribute onfocus to each element.
because sir there are 10 to 15 forms and each has 10 to 15 element.

i do it as:

function getElementWithFocus()
{
var f_ele = null;
for(var i=0;i<parent.mainFrame.document.forms.length;i++)
{
try
{
if ( parent.mainFrame.document.forms.elements[i].gotFocus )
{
alert( parent.mainFrame.document.forms.elements[i].name + ' has focus!');
f_ele = parent.mainFrame.document.forms.elements[i];
break;
}
}
catch (ex)
{
}
return f_ele;
}
}

but its not working or not showing any error.
 
Eric Pascarello
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
well there is no method/property called getFocus

On the window.onload of the for you can set the onfocus handlers on the elements.



Eric
reply
    Bookmark Topic Watch Topic
  • New Topic