[Typo3] [Typo} Modern guestbook with javascript problem

W van Bruggen w.van.bruggen at gmail.com
Fri Mar 11 10:39:47 CET 2005


Hello list,

i'm not really sure if this is something that is being caused by the
modern guestbook, but it could indicate some possible stuff that isn't
possible with it.

I've customized the template for the modern guestbook and added a
javascript function to add smilies by clicking on a smilie image (like
in most forumsoftware these days).

For javascript to input the text in the correct txtarea the line is :
document.formular.tx_veguestbook_pi1[entry]

Problem is, javascript sees the [entry] piece of this string as a
place where array stuff is being inserted. I need to keep the square
brackets to let the form data get properly transferred.

Has anybody encountered this problem before ? Or is this strictly
impossible to do with modern guestbook and javascript ?

The JS code i use is this :

function emoticon(text) {
	var txtarea = document.formular.tx_veguestbook_pi1[entry];
	text = ' ' + text + ' ';
	if (txtarea.createTextRange && txtarea.caretPos) {
		var caretPos = txtarea.caretPos;
		caretPos.text = caretPos.text.charAt(caretPos.text.length - 1) == '
' ? caretPos.text + text + ' ' : caretPos.text + text;
		txtarea.focus();
	} else {
		txtarea.value  += text;
		txtarea.focus();
	}
}

Greets,
Wietse van Bruggen



More information about the TYPO3-english mailing list