This topic is locked

Speel checker smarty template problems

11/26/2006 3:59:06 PM
PHPRunner General questions
G
gdude66 author

Hi I am trying to add a spell checker to my edit page and have installed the app and it works fine.

Below is the code that I have tried to insert in HTML visual editor but it keeps throwing up smarty template errors - specifically to do with the var speller.
Basically the button is clicked and a window pops up that checks all of the spelling in the form. Very nifty app. Does it need to go in the php file or am I putting the code in incorrectly? Using 3.1

This is the script that I placed in the head

<script src="spellChecker.js"></script>

<script>

//

// openSpellChecker()

//

// this function is an example that illustrates the various ways you can invoke

// the the Speller Pages spell-checking process

//

function openSpellChecker() {
// example 3.

// use the spellCheckAll() method to check every text input

// and textarea input in every form in the HTML document.

// You can also use the checkTextBoxes() method or checkTextAreas()

// method instead of spellCheckAll() to check only text inputs

// or textarea inputs, respectively

/

var speller = new spellChecker();

speller.spellCheckAll();

/

}
</script>



and the button in the body

<input type="button" value="Check Spelling" onClick="openSpellChecker()";>

Admin 11/27/2006

Graeme,
Smarty treats "{" character as Smarty tag start.
Either move your javascript code to spellChecker.js file or put {literal} and {/literal} words before and after your code.

I.e.

{literal}

<script>

// openSpellChecker()

{

....

....

....

}
</script>

{/literal}

G
gdude66 author 11/27/2006

Graeme,

Smarty treats "{" character as Smarty tag start.
Either move your javascript code to spellChecker.js file or put {literal} and {/literal} words before and after your code.

I.e.



Thanks that worked a treat.

To get it working I added it to the head in visual editor the following

{literal}

<script language="javascript" src="spellChecker.js"></script>

<script language="javascript" >

function openSpellChecker() {
var speller = new spellChecker();

speller.spellCheckAll();

}

</script>

{/literal}



and the button was added after the reset button on the edit form as

<input type="button" value="Check Spelling" onClick="openSpellChecker();"/>



The spellchecker is available from http://spellerpages.sourceforge.net/ and is opensource - easy to install

It checks the spelling of all input boxes.