Hi, FWIW, the fixed version in your follow-up post works fine on Windows XP in the browsers I've tried it in: FF2, IE6, Safari 3, Opera 9. Most likely an issue with the string you're feeding in or the IDs of the areas. My test string was:
"area1,test1.jsp,x=1,area2,test2.jsp,x=2,area3,test3.jsp,x=3" ...and the JSPs were along these lines: <% out.println("test1: x = " + request.getParameter("x")); %> ...with these "areas" in my HTML page: <div id='area1'>area1</div> <div id='area2'>area2</div> <div id='area3'>area3</div> All three areas updated correctly. -- T.J. Crowder tj / crowder software / com On May 19, 9:06 pm, adrianc <[EMAIL PROTECTED]> wrote: > 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 -~----------~----~----~----~------~----~------~--~---