In non-as-you-type spell checking scenarios it may be desirable to have the inline spell checker work as a validator. This can be configured with asp:CustomValidator as a client script validator.
function validateSpelling(oSrc, args) { //Check if spell check already ran. for (var i = 0; i < rsw_scs.length; i++) { if (rsw_scs[i].textBoxID == oSrc.controltovalidate && rsw_scs[i].hasRun) { args.IsValid = true; return; } } var rapidSpellChecker = new RapidSpellCheckerClient(rapidSpell.ayt_helperURL); rapidSpellChecker.config = rsw_getConfigurationObject('default'); var result = rapidSpellChecker.Check(args.Value); args.IsValid = result.numberOfErrors == 0; }
<asp:CustomValidator id="CustomValidator1" runat="server" ControlToValidate="TextBox1" EnableClientScript='true' ErrorMessage="There are spelling errors and spell check hasn't been performed." ClientValidationFunction="validateSpelling"> </asp:CustomValidator>