Hi,
in a my application, I have an input text and I have to call a web service with the text inserted as a query.
I would that this web service will start after 1 second of keyboard inactivity. How can I do it?
At the moment the service start after a number of words and every new word inserted.
I have a text box in which the user can insert a string that the web service must process.
Now this web service starts every word that user key in the text box.
I would like that the web services will start after 1 or 2 seconds after tha last digit.
Now this web service starts every word that user key in the text box.
Then using a timer of 'keyboard inactivity' would be silly, wouldn't it? What if somebody stopped mid-word to think about something for a second, go to the bathroom, turn off the stove, etc?
With this in mind, you might want to rethink the design of the application. Maybe you want to add a submit button? Maybe you want to call the service after a certain number of characters have been entered, maybe after you've captured a certain keystroke (e.g. enter, space, etc).
I think it's a terrible idea to make a server request based on the fact that somebody stopped typing for 1-2 seconds, if you don't know that they're actually finished typing or not.
Also, for interests sake, what kind of application are you trying to make?
I've switched careers...
I'm NO LONGER a scientist,
but now a web developer...
awesome.
I have a text box in which the user can insert a string that the web service must process.
Now this web service starts every word that user key in the text box.
I would like that the web services will start after 1 or 2 seconds after tha last digit.
I assume you have a function or whatever that checks if the user has inputed "that last digit" and not merely paused for some reason.
If so, you could use the function as an onkeyup event handler to check if the last digit has been entered before submitting the query string from that function using javascript.
Or if you must have a 1 - 2 second delay after the last digit has been entered, you could use setTimeout() in that function to delay the query string submission by whatever time period you like after the last digit has been entered.
Bookmarks