p2p.wrox.com Forums

Need to download code?

View our list of code downloads.


  Return to Index  

asp_forms thread: spell check on line


Message #1 by ken@w... on Wed, 13 Feb 2002 21:11:11
Is there a way to spell check a textarea box? .NET? Maybe a third party 

component?



Any help is appreciated!

Ken
Message #2 by "tshell" <tshell@s...> on Wed, 13 Feb 2002 16:35:49 -0500
Hi Ken-

Small world!  I found this as ASP Free website- haven't tried it, don't know

if it works, but I pasted it below!



-Regards

tshell



Create a new page, add a form, assuming your form is called "form1" and the

text you want to check is called "TEXTAREA1"



<form name="form1">

<TEXTAREA cols=50 id=TEXTAREA1 name=TEXTAREA1 rows=8></TEXTAREA>



Add a button and use the javascript onclick event :



<input type="button" value="Start Spell Check" onclick="SpellCheck();"

id="button1" name="button1">



</form>



Here is the code that actually does the work, you may place this into an

include file if you'd like.



<applet codebase="http://mirrordns.com/spellchecker/"

code="SpellCheck.class" ARCHIVE="spellcheck.jar" height="1" id="Applet1"

name="spellcheck" width="1" ALT="Applet not displayed">

<PARAM NAME="cabbase" VALUE="spellcheck.cab">

  <param name="help_URL" value="http://mirrordns.com/spellchecker/">

  <param name="app_title_version_info" value="XDE SpellChecker Version 1.0">

</applet>



Areas bolded will have to be changed if the form or text box names change:



<script language="JavaScript">

var timerID = null;

function getFlag() {

if(document.spellcheck.flag){

  clearInterval(timerID);

if (document.spellcheck.fixedtext!=""){

    document.form1.TEXTAREA1.value=document.spellcheck.fixedtext;

    }else{

    document.form1.TEXTAREA1.value=document.spellcheck.text;

    }

  }

}

function SpellCheck() {

document.spellcheck.ptexttocheck=document.form1.TEXTAREA1.value;

document.spellcheck.purltouse="http://mirrordns.com/spellchecker/SC_process.

asp";

document.spellcheck.flag = false;

document.spellcheck.debug=true;

document.spellcheck.doDlg();

document.form1.TEXTAREA1.value="Processing ........";

getFlag();

  timerID = setInterval("getFlag()", 2000);

}

</script>





Here is the code that would be used on the demo.

<p><font face="Arial">

<APPLET code=SpellCheck.class codeBase=./ height=1 id=Applet1

name=spellcheck width=1 ALT="Applet not displayed" ARCHIVE="spellcheck.jar">

    <PARAM NAME="cabbase" VALUE="spellcheck.cab">

    <PARAM NAME="img.width" VALUE="100">

    <PARAM NAME="app_title_version_info" VALUE="XDE SpellChecker V1.0">

    <PARAM NAME="help_url" VALUE="http://mirrordns.com/spellchecker/">

    <PARAM NAME="dialog_title" VALUE="XDE SpellChecker">

    <PARAM NAME="logourl" VALUE="xde.gif">

    <PARAM NAME="img.height" VALUE="79">

    <PARAM NAME="homepageurl" VALUE="http://mirrordns.com/">

    </APPLET>

</font></p>



<p><font face="Arial"><A href="demo_multi.htm">Multi Text Box

Demo</a></font></p>



&nbsp;

<script language="JavaScript">

//The following line may be commented out

document.form1.TEXTAREA1.value="Hi, good to heaar from you! I have been very

busy since I startaed haere. Was in Colorado Sprngs (beautiful, I've never

been) last weekend. John (our President) flew all 50 of his employees from

all over the country out to a beautiful resort so everyone could get to know

eachother. This is an unbelievable ";

var timerID = null;

function getFlag() {

    if(document.spellcheck.flag){

    clearInterval(timerID);

        if (document.spellcheck.fixedtext!=""){

    document.form1.TEXTAREA1.value=document.spellcheck.fixedtext;

}else{

    document.form1.TEXTAREA1.value=document.spellcheck.text;

}

}

}

function SpellCheck() {

    document.spellcheck.ptexttocheck=document.form1.TEXTAREA1.value;



document.spellcheck.purltouse="http://mirrordns.com/spellchecker/SC_process.

asp";

    document.spellcheck.flag = false;

//    document.spellcheck.debug=true;

    document.spellcheck.doDlg();

    document.form1.TEXTAREA1.value="Processing ........";

    getFlag();

    timerID = setInterval("getFlag()", 2000);

}

</script>





******************************




  Return to Index