In Key Events shall we call "action" attribute

N

Neelu

In my form i have one textbox whenever i will give data( nearly 2 to 3
characters), the key press event should go and call to some jsp for
fetching data from database depend upon the data given. I got this by
using submit button. I need this one using key event. Is it possible?
 
V

Venky

I guess you can do it..

Code would look something like this

textbox.addKeyListener(
new KeyListener() {
int i=0;
void keyPressed(KeyEvent e) {}
void keyReleased(KeyEvent e) {}
void keyTyped(KeyEvent e) {
i++;
if(i>2) //if number of characters entered is > 2
{
// Do some action
}
}
}
);
 
D

Dag Sunde

Neelu said:
Its really nice...but som syntax error is coming in java script....can
u clarify it

Your problem is that you asked what probably is a JavaScript question
in a Java newsgroup.

You got a Java code response, but used it as JavaScript Code...
Two different languages with some syntactic similarities...

Try "comp.lang.javascript".
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,043
Latest member
CannalabsCBDReview

Latest Threads

Top