Hey all, hoping someone can help me with a workaround. I've got an event set to fire when a textbox changes or loses focus- no problems. However, when the user clicks into the box and Right Click--> Pastes a value into it, I can't get any event to fire. I've tried onClick, OnChange, OnMouseDown, onMouseUp, onKeyDown, and onKeyUp. -
<input type='text' onChange="alert('Changed')" onClick="alert('Clicked')" onMouseDown="alert('onMouseDown')" onMouseUp="alert('onMouseUp')" onKeyDown="alert('onKeyDown')" onKeyUp="alert('onKeyUp')">
I know I can do one of those stupid IE named scripts, but I was hoping someone somewhere had a multi-browser compliant solution! http://msdn2.microsoft.com/en-us/library/ms536955.aspx 9 24422 pbmods 5,821
Recognized Expert Expert
Heya, RB. Welcome to TSDN!
Changed thread title to better describe the problem (did you know that threads whose titles do not follow the Posting Guidelines actually get FEWER responses?).
Please use CODE tags when posting source code. See the REPLY GUIDELINES on the right side of the page next time you post.
acoder 16,027
Recognized Expert Moderator MVP
Welcome to TSDN!
Unfortunately, there's no reliable cross-browser way to capture a paste event. You can check this thread out. Why is it so important to capture this? Can you not just wait for onchange to fire when the text box loses focus?
Thanks PB!
acoder, upon successfully completing the input field in question, that value is then used to auto-complete various other fields on the page. If the user has to wait until they have tabbed/clicked to another input box in order for the auto-completion to kick in, we have violated GUI best practices by separating cause and effect.
Additionally, I have helper text in which prompts the user what is needed, i.e. "Start Date required". That text disappears after a valid date is entered... unless they mouse paste, in which case the text remains, while they can clearly see that a good date WAS entered.
Anyway, thanks for the help!
iam_clint 1,208
Recognized Expert Top Contributor
you can write a timer to check the value of the so called input box
Example provided. -
<script>
-
var ival = "";
-
var checkup = window.setInterval("checkChange();", 100);
-
function checkChange() {
-
var nval = document.getElementById("test").value;
-
if (nval!=ival) { alert("change in the text"); ival=nval; }
-
}
-
</script>
-
<input type="text" id="test" name="test" value="">
-
acoder 16,027
Recognized Expert Moderator MVP
acoder, upon successfully completing the input field in question, that value is then used to auto-complete various other fields on the page. If the user has to wait until they have tabbed/clicked to another input box in order for the auto-completion to kick in, we have violated GUI best practices by separating cause and effect.
Additionally, I have helper text in which prompts the user what is needed, i.e. "Start Date required". That text disappears after a valid date is entered... unless they mouse paste, in which case the text remains, while they can clearly see that a good date WAS entered.
Aah, that makes more sense. Well, iam_clint has posted a good workaround. Hopefully that should solve your problem.
Thanks iam- I'll look into it!
pbmods 5,821
Recognized Expert Expert
I wonder if you can use an onclick or maybe onrightclick (?) event handler that compares the current value of the textbox to the last value....
[EDIT: Just about the same thing iam_clint posted, except without the setInterval() call. Ah well.]
Thanx ....
this was really helpful...
we can call the same function used to capture rest of mouse and key events(onkeyup, onblurr etc) .
this is wat i did for a multiline textbox to change the height dynamically - <asp:TextBox ID="txtdemo" runat="server" TextMode="MultiLine" Width="286px" onmouseup = "fnStartClock()" onkeydown="textAreaSize()" onblur="textAreaSize()" onfocus="textAreaSize()" onkeyup="textAreaSize()" height="16px" ></asp:TextBox>
- ////////////////////////////////////////////////////
-
function used for any event after clicking the mouse button called for a particular interval(for onmouseup and onmousedown)
-
///////////////////////////////////////////////////
-
var oInterval;
-
function fnStartClock(){
-
if(oInterval!=null)
-
{
-
window.clearTimeout(oInterval);
-
i=0;
-
}
-
oInterval = window.setInterval("textAreaSize()", 200);
-
-
}
-
-
//////////////////////////////////////////////////
-
here textAreaSize() is the function called for the rest of the events....
-
it is used to change the height of a multiline textbox on entering a data
-
/////////////////////////////////////////////////
-
var i=0;
-
-
function textAreaSize()
-
{
-
-
var na= document.getElementById('ctl00_BodyContent_txtdemo')
-
-
var text = na.value.replace(/\s+$/g,'') ;
-
var split = text.split("\n");
-
var tbHeight = 16*split.length;
-
if(tbHeight>200)
-
tbHeight=200
-
document.getElementById('ctl00_BodyContent_txtdemo").style.height = tbHeight;
-
i++;
-
if(i>100)
-
{
-
window.clearTimeout(oInterval);
-
i=0;
-
}
-
-
}
hope this is helpful.....
Thanks Clint, that was very helpful.
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Earl Eiland |
last post by:
Anyone know how to capture text from GUI output? I need to process
information returned via a GUI window.
Earl
|
by: Brad Shook |
last post by:
Ok here is what I a trying to do. I am trying to emulate an operator having
to do repetitive tasks on a 3rd party program. Here is what I am doing so
far. It works.
Start Code
Dim myProcess As Process = System.Diagnostics.Process.Start("C:\ca\wb.exe")
myProcess.StartInfo.WindowStyle = ProcessWindowStyle.Normal
' wait until the program is ready for input
myProcess.WaitForInputIdle(1000)
If myProcess.Responding Then
|
by: TomTom |
last post by:
Hi,
With C#, is it possible to hover a mouse pointer on the Windows UI controls
and show the UI text? For example, can I hover my mouse over "File" in the
menu bar and show the text "File" on a label?
I've seen a program like this but not sure if it can be done with C#.
Thanks!
TomTom
|
by: Krishna Kumar |
last post by:
Hai all,
I am doing a project in .net and in that project I have a problem in
capturing text from an image. i.e images like CAPTCHA images . which has
inbuilt text with in the image.So, Can any one suggest me how to continue
my work or give their valuable suggestions for capturing text in the
CAPTCHA image .
yours
KrishnaKumar
|
by: mwhite |
last post by:
Hi,
I need to find a way of capturing the text from a Word document, and
storing it. Preferably as a string, as I then need to be able to
manipulate the text in code and display it in my web app.
Please help!
Thanks in advance
Mat
| |
by: ffreino |
last post by:
Hi,
I'm trying to capture text between two words in a multi-line string.
For example:
89. This is the text I would like to capture.
This is another line.
90. End of the example.
I would like to capture text between the words (numbers in this case)
'89' and '90'
|
by: whizkid0000 |
last post by:
Apologies for this query for i think it is pretty straightforward.
(VB 6.0)
Through a SQL query i have got a string which needs to be put in a textpad.(form code). Till now i am able to put data in dropdown(list down) boxes but not in textoad. The error its giving is invalid procedure call.
A few code snippets i shall give to make the picture clearer.
sQueryGetReviewer = "Select #### from #### where user_id = '" + UserName + "'" ' Get...
|
by: krishnan2408 |
last post by:
hi,
I want to get all the text that is displayled in a java application window running in the unix OS. I am right now working in the X11::GuiTest module.
Can anyone please suggest me any module(or function) to fulfill this requirement?
If this is not possible, is it possible to capture the window into a .jpg file(say) and then get the text from it.
Please suggest some modules which will work in the unix OS.
I don't think the...
|
by: mohanprasadgutta |
last post by:
Hello,
I want to capture the text being printed on console.
problem description is as follows.
I am calling called.pl program from caller.pl program using backticks.
in called.pl program i am giving an external command to be executed in backticks.
that external application will through a message to the console if any arguements are missing for that command.
for example if we are not sending username and password(or wrong username and...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
| |
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |