Dart Home | PowerWEB TextBox for ASP.NET | Custom Development | Reply | PowerWEB TextBox for ASP.NET Topics | Forums |
Author | Forum: PowerWEB TextBox for ASP.NET Topic: Client side events... are there any? |
Captell From: Melbourne, Australia Posts: 10 Member Since: 03/29/09 |
posted May 30, 2009 12:17 PM Hi there, I'd like to know what client side events are available. I can't find any described in the doco. In my app I've pretty much got it to do what I want but i've had to "cludge" a few things. For instance I want to know when the text has changed, I can't find any client side TextChanged event so I start a timer that pops every 15 seconds captures the text using pwGetEditorText() storing same in global variable, then next time around compares the two to determine if the user has changed anything. I also have a requirement to show a preview of a completed document, this is built from a template stored in a database on the server and merged with text from the TextBox. The Preview must be built on the server, I do this with an AJAX call to an ASPX page. Again I'd really like some client side events to trigger this process, like KeyDown, I could then check for the ENTER key (My app requires the users to only enter bulleted lists) signifying the end of a bullet point and fire off an AJAX call. Instead I'm again having to resort to a setInterval call to build the preview every 15 seconds... which is ok but as I indicated earlier a bit clunky. So, my question, are there any client side events and if not... how about adding some in for the next release. |
K M Drake From: Utica, NY USA Posts: 3406 Member Since: 07/14/00 |
posted June 2, 2009 10:58 AM Hi, There are not client-side events, but you can indicate to the browser to execute client-side code from within server-side events using HtmlBox.BufferedScript.Write. For example: HtmlBox1.BufferedScript.Write("myClientSideFunction();"); Hope it helps, -ken ------ |
Captell From: Melbourne, Australia Posts: 10 Member Since: 03/29/09 |
posted June 2, 2009 6:25 PM Hi Again, Actually it can be done using client side only. For example on my aspx page I add an attribute to the HTMLBOX. hb.Attributes.Add("onkeydown", "return keyDown();") then whenever a key is pressed the keyDown javascript function is called. function keyDown() { if(event.shiftKey && event.keyCode==9) { pwFormatOutdent(); return false; } else if(event.keyCode==9) { pwFormatIndent(); return false; } else if(event.keyCode==13) { UpdatePreview(); return true; } return true; } Some of the other events I've been able to override are hb.Attributes.Add("onkeydown", "return keyDown();") hb.Attributes.Add("onpaste", "return Paste();") hb.Attributes.Add("oncopy", "return Copy();") hb.Attributes.Add("oncut", "return Cut();") hb.Attributes.Add("onmouseup", "return false;") There are bound to be others. |
K M Drake From: Utica, NY USA Posts: 3406 Member Since: 07/14/00 |
posted June 4, 2009 4:22 PM Hi, Thanks for posting this. -ken |
Reply | PowerWEB TextBox for ASP.NET Topics | Forums |
This site is powered by PowerTCP WebServer for ActiveX |