Starting spell check on client side events
|
Article relates to
|
RadSpell Classic v.3+,RadSpell "Prometheus"
|
|
Created by
|
Tsvetelina, Telerik
|
|
Last modified
|
2008/04/14
|
|
Last modified by
|
Georgi Popivanov
|
HOW-TO
Start spell check on client side events.
DESCRIPTION
It is a common goal to start the process of spell checking when a ceratin client-side event is fired. This process is started by means of a JavaScript function and you can easily configure the RadSpell control to start it on a client-side event by calling that function. This KB article will guide you through the steps of achieving that result with the onBlur event of the Textbox control. While we use a certain control and event for the purpose of our demonstration, you can easily apply these steps on any other control and event.
SOLUTION
The example that we will go through will setup a TextBox control that automatically checks the spelling of its text once a user finishes typing and moves on to another control.
- Let us assume that the control you want to check has ID "targetText". Set the ControlToCheck property of the RadSpell object to "targetText" and the ButtonType property to "None":
| <radS:RadSpell id="spell" Runat="server" ControlToCheck="targetText" ButtonType="None"> |
| </radS:RadSpell> |
| |
- Define a JavaScript function that will start the process of spell checking:
| <script language="javascript"> |
| function spellCheck() |
| { |
| GetRadSpell('<%= spell.ClientID %>').StartSpellCheck(); |
| } |
| </script> |
Please pay attention to the <% %> block - it gets the correct client id of the RadSpell object.
- Configure the TextBox to call the JavaScript function you just defined when the onBlur event fires:
| <asp:TextBox id="targetText" onblur="javascript: spellCheck();" runat="server"> |
| this is a mistakr |
| </asp:TextBox> |
- Let us assume that the control you want to check has ID "targetText". Set the ControlToCheck property of the RadSpell object to "targetText" and the ButtonType property to "None":
| <telerik:RadSpell id="spell" Runat="server" ControlToCheck="targetText" ButtonType="None"> |
| </telerik:RadSpell> |
| |
- Define a JavaScript function that will start the process of spell checking:
| <script language="javascript"> |
| function spellCheck() |
| { |
| var spell = $find("<%= spell.ClientID %>"); |
| spell.startSpellCheck(); |
| } |
| </script> |
Please pay attention to the <% %> block - it gets the correct client id of the RadSpell object.
- Configure the TextBox to call the JavaScript function you just defined when the onBlur event fires:
| <asp:TextBox id="targetText" onblur="javascript: spellCheck();" runat="server"> |
| this is a mistakr |
| </asp:TextBox> |
Comments
If you'd like to comment on this KB
article, please, send us a
Support Ticket.
Thank you!
Please
Sign In
to rate this article.