Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
630
Infragistic webspell checker
posted

Hi,

I am using a 3rd party spell checker software currently in our web application.since  we are using many infragistic controls througout our application i was thinking wether i could use the spell checker provided by infragistic so that we could get rid of the 3rd party component.My requirement is this.in a simple webpage there are 4 text areas and the users can enter any values in any of these fields when the user click on save all the values should be storedin DB after spell check.please let me know if this is possible with the infragistic spell checker.also if the fields has multiple error the spell cheker should handle it.i.e, it should handle multilple fields for eg if i give change all it should apply the fix and automatically go to the next field.

Parents
No Data
Reply
  • 24497
    posted

    Hi,

    WebSpellChecker supports few different scenarios.

    1. It can be attached to a specific button and specific id of target INPUT. In this case no event processing is required. Below is example:


    <asp:TextBox ID="TextBox1" runat="server" Text="Thiis is 1"></asp:TextBox>
    <input id="Button1" type="button" value="button1" />
    <ig_spell:WebSpellChecker ID="WebSpellChecker1" runat="server" ButtonId="Button1" TextComponentId="TextBox1"></ig_spell:WebSpellChecker>

    2. The spellcheck action can be invoked from javascript, and supports can take 3 parameters: 1-text to check, 2-(optional) function which provides fixed text, 3-(optional) id of INPUT which value will be set with fixed text.
    Below is example with 3rd param:

    <script type="text/javascript">
     
    function click2() {
      
    var spell2 = ig$('<%=WebSpellChecker2.ClientID%>');
      
    var text2ID = '<%=TextBox2.ClientID%>';
      
    var text2 = document.getElementById(text2ID);
      
    spell2.checkSpelling(text2.value, null, text2ID);
     
    }
    </script>
    <asp:TextBox ID="TextBox2" runat="server" Text="This is secont"></asp:TextBox>
    <input type="button" value="button2" onclick="click2()" />
    <ig_spell:WebSpellChecker ID="WebSpellChecker2" runat="server"></ig_spell:WebSpellChecker>

    3. Below is example with return function (note in the very latest current version that option was accidentally disabled, but previous and coming fixes do support that):

    <script type="text/javascript">
     
    function onSpellComplete(fixedValue) {
      
    document.getElementById('<%=TextBox3.ClientID%>').value = fixedValue;
     
    }
      function click3() {
      
    var spell3 = ig$('<%=WebSpellChecker3.ClientID%>');
      
    var text3ID = '<%=TextBox3.ClientID%>';
      
    var text3 = document.getElementById(text3ID);
      
    spell3.checkSpelling(text3.value, onSpellComplete);
     }
    </script>
    <asp:TextBox ID="TextBox3" runat="server" Text="Thiss is 3"></asp:TextBox>
    <input id="Button3" type="button" value="button3" onclick="click3()" />
    <ig_spell:WebSpellChecker ID="WebSpellChecker3" runat="server"></ig_spell:WebSpellChecker>

    It is possible to create a loop with setTimeout and process multiple inputs in one shot using single spellchecker.
    Also spellchecker allows to disable "final" alert notification, so, application may skip it or create its own notification.

    4. Older versions supported only second or third parameter, but not both. In coming service release, both parameters will be supported. That will allow to skip explicit fix of target INPUT and to simplify javascript and notification function can be used for other purposes, for example as a flag to trigger validation of next target INPUT. Below is example, which uses both parameters (will work only with new updates) and which updates multiple target INPUTs in one shot.

    <script type="text/javascript">
     
    var idsToCheck = ["<%=TextBox3.ClientID %>", "<%=TextBox4.ClientID %>"];
     
    function doSpellCheck(index) {
       
    if (index < idsToCheck.length) {
         
    var spell = ig$('<%=WebSpellChecker4.ClientID%>');
         
    var id = idsToCheck[index];
         
    var func = function() {
             
    setTimeout(function() { doSpellCheck(++index); }, 0);
         
    };
            spell.checkSpelling(document.getElementById(id).value, func, id);
          } else {
           
    alert('Spell check was completed');
      
    }
     }
    </script>

    <asp:TextBox ID="TextBox3" runat="server" Text="Thiss is 3"></asp:TextBox>
    <asp:TextBox ID="TextBox4" runat="server" Text="Thiis is 4"></asp:TextBox>
    <input type="button" value="button4" onclick="doSpellCheck(0)" />
    <ig_spell:WebSpellChecker ID="WebSpellChecker4" runat="server">
     
    <DialogOptions ShowFinishedMessage="false"/>
    </ig_spell:WebSpellChecker>

Children
No Data