Hi,

You haven't actually quoted the bit of code that loops through
`smilies_img_path`, or the code that calls `toolBar`, but from the
error message I can make two predictions:

1. The `smilies_img_path` parameter to `toolBar` is an Array.

2. The code for looping through outputting the smilies looks something
like this:

    for (smiley_path in smilies_img_path) {
        // ...output the smiley using smiley_path...
    }

If I'm correct about those assumptions, the problem is that the author
of that code doesn't understand what `for..in` does (a LOT of people
don't). They're assuming it loops through the indexes of an array. It
doesn't. Details here:
http://blog.niftysnippets.org/2010/11/myths-and-realities-of-forin.html

If I'm right about the above, then the only way you'll get Prototype
and this other software to happily co-exist is to get the authors of
the other software to fix their `for..in` loops, because Prototype
adds a lot of functions to the `Array.prototype` and that's why you're
seeing functions in the result. (Again, details in the link above.)

HTH,
--
T.J. Crowder
Independent Software Engineer
tj / crowder software / com
www / crowder software / com

On Nov 5, 9:59 pm, Bagu <bagu....@gmail.com> wrote:
> Hello,
>
> I use Prototype & script.aculo.us (latest version) on a fluxbb forum
> to have autocomplete and autorefresh feature.
> The problem is that when i display a smiley bar with an other
> javascript function, i get many error messages on apache log.
>
> Here is an example on error message :
> [Fri Nov 05 03:07:18 2010] [error] [client 66.131.132.226] (20024)The
> given path is misformatted or contained invalid characters: access to /
> img/smilies/function (_58) {    var _59 = true;    this.each(function
> (_5a, _5b) {_59 = _59 && !!(_58 || Prototype.K)(_5a, _5b);if (!_59)
> {throw $break;}});    return _59;} failed
>
> The function wich cause the error is : tb.barSmilies(smilies);
> Here is the function :
>         function btSmilies(img, label)
>         {
>                 addButton(img, label,
>                         function() {
>                                 var element = 
> document.getElementById('smilies');
>                                 if (element.style.display == 'block' )
>                                 {
>                                         textarea.focus();
>                                         element.style.display = 'none';
>                                 }
>                                 else
>                                 {
>                                         textarea.focus();
>                                         element.style.display = 'block';
>                                 }
>                         });
>         }
>
> And the addButton function :
>         function addButton(src, title, fn)
>         {
>                 var i = document.createElement('img');
>                 i.src = bt_img_path + src;
>                 i.title = title.replace(/&quot;/g, '"');
>                 i.style.padding = '0 5px 0 0';
>                 i.onclick = function() { try { fn() } catch (e) { } return 
> false };
>                 i.tabIndex = 400;
>                 toolbar.appendChild(i);
>         }
>
> Every function are in an other with begin by :
> function toolBar(textarea, bt_img_path, smilies_img_path)
> {
>         if (!document.createElement)
>                 return;
>
>         if ((typeof(document['selection']) == 'undefined')
>         && (typeof(textarea['setSelectionRange']) == 'undefined'))
>                 return;
>
>         var toolbar = document.createElement('div');
>         toolbar.id = 'toolbar';
>         toolbar.style.padding = '4px 0';
>
>         var smilies = document.createElement('div');
>         smilies.id = 'smilies';
>         smilies.style.display = 'none';
>         smilies.style.padding = '0.3em 0';
>
> I really don't understand how Prototype & script.aculo.us can cause
> this error.
> And i'm sure it come from Prototype & script.aculo.us and these
> functions.
> Because when i remove my script call to Prototype & script.aculo.us,
> there is no more errors, and it's the same when i comment btSmilies
> function.
>
> Could you help me to correct the problem please ?

-- 
You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to prototype-scriptacul...@googlegroups.com.
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en.

Reply via email to