Darrin,

Thanks for pointing that out. The loop was correct originally, but it
got mangled during debugging. The corrected code is:

/** Update multiple areas (HTML container elements).
  * @param areaCsvString The area CSV string. The CSV string is a flat
array in the
  * form of: areaId, target, target parameters [, areaId, target,
target parameters...].
*/
function ajaxUpdateAreas(areaCsvString) {
    var areaArray = areaCsvString.split(",");
    var numAreas = parseInt(areaArray.length / 3);
    for (var i = 0; i < numAreas * 3; i = i + 3) {
        new Ajax.Updater(areaArray[i], areaArray[i + 1], {parameters:
areaArray[i + 2]});
    }
}

It still doesn't work in IE.


On May 19, 12:43 pm, darrin <[EMAIL PROTECTED]> wrote:
> I can't bring myself to tell you what's wrong (hint: it's not
> prototype), but try some simple debugging, like putting an
> alert('here') before/after the Ajax.Updater call, to make sure your
> *loop* is actually working as you expect it to.
>
> On May 19, 11:53 am, adrianc <[EMAIL PROTECTED]> wrote:
>
> > I apologize if my question duplicates something asked before. I'm new
> > to JS programming and a search of this group didn't provide an answer.
>
> > I'm trying to interface an existing application framework to
> > Prototype. I have a small set of JS functions the framework calls to
> > use the Prototype library.
>
> > One of the functions creates multiple instances of Ajax.Updater when a
> > form is submitted. Only the first Ajax.Updater works, the rest don't
> > do anything. Here is the code:
>
> > /** Update multiple areas (HTML container elements).
> >   * @param areaCsvString The area CSV string. The CSV string is a flat
> > array in the
> >   * form of: areaId, target, target parameters [, areaId, target,
> > target parameters...].
> > */
> > function ajaxUpdateAreas(areaCsvString) {
> >     var areaArray = areaCsvString.split(",");
> >     var numAreas = parseInt(areaArray.length / 3);
> >     for (var i = 0; i < numAreas; i = i + 3) {
> >         new Ajax.Updater(areaArray[i], areaArray[i + 1], {parameters:
> > areaArray[i + 2]});
> >     }
>
> > }
>
> > I thought maybe the Ajax.Updater instances were erasing each other, so
> > I put them in array elements - but that didn't fix the problem.
>
> > I have confirmed the string argument passed to the function is
> > correct. I have confirmed each Ajax.Updater instance works
> > individually.
>
> > Any ideas?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Spinoffs" group.
To post to this group, send email to rubyonrails-spinoffs@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to