Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

#1375 SquirrelSpell Form count bug&fix

closed-fixed
nobody
Compose (426)
5
2003-07-21
2003-07-20
Anonymous
No

This problem/fix involves specifically init.js and
check_me.js in plugins/squirrelspell/js and an
incompatibility with other plugins/addons, those that
use forms.

I easily installed Squirrelmail 1.4.1 using Apache
1.3.27 and PHP 4.3.1 on Slackware 9.0. I started
installing plugins, first was Link Buttons 1.2. Now
every link in the top menu is a form. Then came Notes
1.0. Notes adds yet another button to the menu, and yet
another form. (It may be that a person who installed
notes without Link Buttons gets a link instead of a
button, I didn't check)

The problem is that the text grab commands in the
init.js calls for
opener.document.forms[0].[subject|body].value. This is
fine, when you don't have 8 extra forms at the top of
the page, such that the message composition exists as
form 0, the first on the page.

When you add forms, it tries to get text from a
nonexistent input area, since the form is now
opener.document.forms[8]. (I have 8 buttons preceding
the actual composition area.) What happens is the
SquirrelSpell popup tells me (in Mozilla Firebird 0.6)
the "please wait" message, and then nothing. The status
bar reports "done".

I got the script to run by changing the forms[] value
to 8, of course. Then, while fixing my garbage, I found
that only "Close and Cancel" would close the window.
"Close and Commit" did nothing but warn me that the
spellchecker was not finished, and when the
spellchecker had sctually finished and told me so, my
decision to close and commit did the same: nothing.
That's when I realized that check_me.js was trying to
write to opener.document.forms[0] as well. thanks
javascript console.

I changed the 2 instances of that one in check_me.js,
and it sent back the changes correctly. Now instead of
worrying about the number of forms preceding the
composition form, I found that I could change the
forms[8] to compose and it targeted the correct form
and data.

So call it by name, not number.

init.js:
line 22:

textToSpell = opener.document.forms[0].subject.value
+ "\n" + opener.document.forms[0].body.value;

should be:

textToSpell = opener.document.compose.subject.value +
"\n" + opener.document.compose.body.value;

check_me.js:
line 281-282:

opener.document.forms[0].subject.value=newSubject;
opener.document.forms[0].body.value=newBody;

should be:

opener.document.compose.subject.value=newSubject;
opener.document.compose.body.value=newBody;

thanks for a great app

--Rob
rpc@cafe4111.org

Discussion

    • status: open --> closed-fixed
     
  • Logged In: YES
    user_id=285765

    Fixed, thanks!