Hi, I urgently need help, please.
WebtextEdit ClientSideEvent execute javascript statement on mousemove event. I can successfully change the style of another object type on this WebTextEdit ClientSide MouseMove event:document.getElementById("Object2").style.backgroundColor = '#F0F5F7';
But when I want to change the style of the WebTextEdit control:document.getElementById("WebTextEdit1").style.backgroundColor = '#F0F5F7'; Then nothing happens
When I execute the script on the same WebTextEdit Clientside for another object which is not a WebtextEdit:Object2.style.border='1px solid #FFE6A0'; Then it works
But when I want to change the WebtextEdit Clientside style:WebTextEdit1.style.border='1px solid #FFE6A0';
Then I get Error: Can't Eval WebTextEdit1.style.border='1px solid #FFE6A0';
Please Help
You want to use the CSOM of the WebTextEdit, rather than just the JavaScript DOM. The WebTextEdit object you get from one of the client-side events is a JavaScript object, but not directly an HTML element. The object does not directly have a "style" property, which is why you get this error.
The style properties, including borders, are off the Element property of the WebTextEdit control itself.
function WebTextEdit_MouseMove(oEdit, text, oEvent){ oEdit.Element.style.backgroundColor = '#F0F5F7';}
Please remember that this is a peer-to-peer forum. We'll post answers when and as we can, but we may not be able to handle "urgent" issues so quickly. For official assistance from Infragistics, particularly for urgent issues, you should likely submit a support request instead of using the forums.
Thank You for your kindness, patience & help.
Please Assist, I can't get it going: on the WebTextEdit Object (FG1010NItemD) - ClientSideEvent - MouseOver:
I tired inserting the following javascript within the MouseOver property:
FG1010NItemD.Element.style.backgroundColor = '#F0F5F7';
oEdit.FG1010NItemD.style.backgroundColor = '#F0F5F7';
oEdit.Element.style.backgroundColor = '#F0F5F7';
Aplogies for being a nuisance but please assist as I don't really know how to do this.
Please Assist!
VBScript and JavaScript aren't the same, and my expertise is with JavaScript. Mixing these two languages is likely going to cause you problems. Since we write our controls with JavaScript, my suggestion is to stick with JavaScript, not VBScript.
I can't otherwise speculate what may be causing the code you've written to not function. You should submit a support request for further assistance on this issue; it's beyond what I can assist with through the forums.
By the way, is there a reason you're not using ASP.NET validators? They'd provide similar functionality in a much-easier-to-code manner.
Hi, I'm coding in an application that uses VBscripting code, I can only uses javascript in it's Clientside Properties.
On this application I have to use vbscripting, how do I get this do be done in vbscript or execute the javascript within the vbscript window?
Thank You
Hi,
WebTextEdit and all other Infragistics controls support only javascript client side events.
If you have problems with manual writing <script> blocks, then try following:
1. Open aspx in Design view2. Right mouse click on WebTextEdit and select Properties3. Find ClientSideEvents, select event which you are interested in and click drop-down button which should appear for that property4. In drop-down list select "Add new handler..."5. In dialog which should appear, you may modify name of your handler or keep default value6. Click OK7. Designer should switch to Source view and point you to the content of that function.8. To test/debug/implement that function you may start with typing-in something simple like alert("my handler");9. Run page and confirm that alert appears on that event.10. Do your implementation. To check if it is executed without exceptions you may put alert("#") after every statement and validate that all alerts are fired. You also insert debugger; statement at any point in you codes and verify flow of logic.
Thank You all, I could not tecute the javascript within an vbscript window - so I don't know aspx nor xslt.
I just wanted the Webtextedit - to change backround color when no value was found. Thats why i thought of executing in the submit (vbscript) code or invalidvalue method.
How do I get the client side events to work with a webtextedit control in a UserControl? I have this code.
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="MultiLineTextEditWithCharacterCount.ascx.cs" Inherits="CharityCheck.MultiLineTextEditWithCharacterCount" %><%@ Register tagprefix="ig" namespace="Infragistics.Web.UI.EditorControls" Assembly="Infragistics35.Web.v9.2, Version=9.2.20092.2056, Culture=neutral, PublicKeyToken=7dd5c3163f2cd0cb" %>
<ig:WebTextEditor ID="webTextEditor1" runat="server" BorderWidth="1px" BorderColor="#898989" Width="480px" Height="90px" TextMode="MultiLine"> </ig:WebTextEditor><br /><asp:PlaceHolder ID="PlaceHolder1" runat="server"></asp:PlaceHolder>
I then do this in the Page_Load method of the UserControl based class:
scriptText = "<script type=\"text/javascript\" id=\"igClientScript\">\n" + " function keyPressInEdit(oEdit, keyCode, oEvent) {\n" + " var text = oEdit.get_value();\n" + " var ar = text.split(' ')\n" + " if (ar.length >= " + this.MaxWordCount + ")\n" + " oEvent.cancel = true;\n" + " }\n" + "</script>\n";
Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "keyPressInEdit", scriptText); webTextEditor1.Attributes.Add("onkeypress", "keyPressInEdit(oEdit, keyCode, oEvent)");
When I run the page with the UserControl in it and type a character in the webtexteditor, the debugger stops in the javacode at the keyPressInEdit method saying the oEdit is undefined. keyCode and oEvent are also undefined. What do I have to do to make this work
Thanks for your reply.
I will try this.
Hi AniLex,
I assume that you ask about image on custom button used by WebTextEditor.
There is no public option to modify image/css of buttons on client. However, javascript object of editor stores all data related to buttons in internal variable _buttons. You may use debugger to find these and other options. Below is example of codes, which changes image of custom button.Note: any side effects of usage internal variables are not supported.
<script type="text/javascript">function changeImg(){ var editor = $find('<%=WebTextEditor1.ClientID%>'); var buts = editor._buttons; // 0-upperspin button, 1-lowerspin button, 2-custom button var but2 = buts[2]; if(!but2) return; var imgElem = but2.imgE, images = but2.img, state = but2._state; //debugger; //alert('currentImg:' + imgElem.src + '\ncurrentState:' + state + '\nstateImages:' + images); var imageNormal = './images/butImg.gif', imageHover = './images/butImgHover.gif'; var imagePressed = './images/butImgPress.gif', imageDisabled = './images/butImgDis.gif'; but2.img = [imageNormal, imageHover, imagePressed, imageDisabled]; imgElem.src = imageNormal; //or better //imgElem.src = but2.img[state];}</script> <input type="button" value="changeImg" onclick="changeImg()" /> <ig:WebTextEditor ID="WebTextEditor1" runat="server"> <Buttons CustomButtonDisplay="OnRight"></Buttons> </ig:WebTextEditor>
How to change the image of WebTextEditControl from javasript?
Thanks,
AniLex
Hi Jorge,
All 3 your emails passed through.
The events on client are based on dot-net ajax framework which supports only 2 params (they mimic corresponding model on server). The 1st param is reference to owner/sender (WebTextEditor) and second param is eventArgs. In case of TextChanged event it is instance of Infragistics.Web.UI.TextEditorTextChangedEventArgs class. It has 2 methods (they are considered "properties" by dot-net-ajax rules): get_text() and get_oldText().
To learn available features on client model, I suggest you to look at docs or you may find them directly in debugger. Under IE the debugger window will show you all members of an object. So, you may insert "debugger;" line in your handler and check methods of second param.
Hi Viktor
I was wondering how could I get the old text from the event TextChanged from the AJAX component "WebTextEditor" that only has two parameter (sender, e). I want to do something similar to the non ajax component WebTextEdit that provides a parameter with the old value.
I have been trying to ask this twice, but the for some reason the forum is not working properly with mozilla 3.6.2. Hope you get this one from IE :)
Many Thanks
Jorge from ANS