[Proto-Scripty] Re: IE8 responseXML ?
On 09/18/2009 06:43 AM, david wrote: Hi Jason, In fact by writting parent_response(), it indicate that you execute the function on the creation of the AJAX request, and the retruned of the execution of the function value will be used for the onComplete. So the onComplete value will be uindefined (as you return nothing in the function). By setting parent_response, you copy the function definition to the onComplete parameter. This is the big difference. Yes, that is a massive difference ... Thanks for the explanation ! The originalRequest in your parent_response function is in fact an response Object, go and see the API doc at http://prototypejs.org/api/ajax/response If the originalRequest.text value inside the function is your XML document, it should be a problem in header not recognize by IE. in that case, you should create an XML document by yourself with the returned text or modify header. The exact output of the program being called is follows : ?xml version=1.0 encoding=ISO-8859-1? departments ou value='1' name='Academics' / ou value='2' name='Admissions' / /departments I *think* this is valid, though it is missing a doctype header. It's a php script outputting this which we've written to send a header of: Content-type: application/xml One thougth, is it a well formed XML, beginning with xml ... asthe root tag ? it could also be a reason. I believe it's well-formed, at least to my knowledge.. To know what contain originalRequest just paste on this thread the retruned value of: $H(originalRequest).inspect(). We will have all info on that object. via IE8? It returns nothing. I tried adding: alert($H(originalRequest).inspect()); to the parent_response method and the alert never shows up when running via IE8. -- david -- --- Jason Frisvold xenopha...@gmail.com --- I love deadlines. I like the whooshing sound they make as they fly by. - Douglas Adams --~--~-~--~~~---~--~~ 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-scriptaculous@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 -~--~~~~--~~--~--~---
[Proto-Scripty] Re: IE8 responseXML ?
On 09/18/2009 03:00 PM, Jason Frisvold wrote: via IE8? It returns nothing. I tried adding: alert($H(originalRequest).inspect()); to the parent_response method and the alert never shows up when running via IE8. I have discovered more.. Adding an onException block like this : function update_parent() { /** retrieve XML */ var root = 1; var myAjax = new Ajax.Request(url, { method: 'get', parameters: {parent_id: root}, onSuccess: function(response) { alert('SUCCESS: ' + response.responseText); }, onFailure: function(response) { alert('FAILURE: ' + response); }, onException: function(request,error) { alert('EXCEPTION: ' + error.message); }, onComplete: function(response) { alert('COMPLETE: ' + error.message); } } ); } ends up with IE8 popping up an EXCEPTION: Access is denied. message.. Access to what, though? -- david -- --- Jason Frisvold xenopha...@gmail.com --- I love deadlines. I like the whooshing sound they make as they fly by. - Douglas Adams --~--~-~--~~~---~--~~ 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-scriptaculous@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 -~--~~~~--~~--~--~---
[Proto-Scripty] Re: IE8 responseXML ?
AHA!!! I have resolved this. We had a base element in the head of the document. Apparently this is to reference where the images/css/etc are. This causes IE8 to prevent javascript from retrieving a page due to security restrictions. I'd feel dumb about it if I didn't think this was a really poor way to secure javascript. Why they can't compare the destination domain of the request to the domain of the original HTML, I don't know. Either way, I have both resolved the problem and learned a bunch about prototype/javascript in the process. Thanks a lot, david, I really appreciate the help! -- --- Jason Frisvold xenopha...@gmail.com --- I love deadlines. I like the whooshing sound they make as they fly by. - Douglas Adams --~--~-~--~~~---~--~~ 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-scriptaculous@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 -~--~~~~--~~--~--~---
[Proto-Scripty] Re: IE8 responseXML ?
On 09/17/2009 07:14 AM, david wrote: Hi Jason, the way you write it is good even in IE. When write onComplete: parent_response() , you launch the function at initialisation time, and the AJAX was not call, so you input is undefined. If you test alert(originalRequest) you should also have undefined. When should this be launched, then? I thought onComplete called the callback function after the entire ajax call had completed, regardless of success/failure ? For your trouble, what is the response text of the AJAX request ?? you should check it too, in case xML was not recognize by IE and set as text. It definitely returns XML .. It's something like this : Departments ou name='foo' value='bar' / ou name='baz' value='qux' / /Departments The parent_response function will parse that, create what I need, and display it. The problem is, originalRequest doesn't seem to get set, or if it does, it's not by what I'm expecting. Should I call the AJAX some other way instead of via the body onload? -- david On 16 sep, 23:26, Jason Frisvold xenopha...@gmail.com wrote: Hi, I'm running into a problem with IE8 and responseXML. Code follows : var url = 'http://example.com/myfile.php'; function update_parent() { var root = 1; var myAjax = new Ajax.Request(url, { method: 'get', parameters: {parent_id: root}, onComplete: parent_response } ); } // --- function parent_response(originalRequest) { var domObj = originalRequest.responseXML; alert(domObj); } This is all fired off via a body onload='update_parent' This works perfectly in Firefox. However, in IE8, it is failing with no errors. The alert in parent_response() does not get triggered in IE8. If I change the onComplete: to read : onComplete: parent_response() Then the alert triggers, but it pops up as undefined. How do I properly handle this so it works cross-browser? ie, what object should I be sending to get to the responseXML value? Thanks, -- --- Jason Frisvold xenopha...@gmail.com --- I love deadlines. I like the whooshing sound they make as they fly by. - Douglas Adams -- --- Jason Frisvold xenopha...@gmail.com --- I love deadlines. I like the whooshing sound they make as they fly by. - Douglas Adams --~--~-~--~~~---~--~~ 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-scriptaculous@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 -~--~~~~--~~--~--~---
[Proto-Scripty] IE8 responseXML ?
Hi, I'm running into a problem with IE8 and responseXML. Code follows : var url = 'http://example.com/myfile.php'; function update_parent() { var root = 1; var myAjax = new Ajax.Request(url, { method: 'get', parameters: {parent_id: root}, onComplete: parent_response } ); } // --- function parent_response(originalRequest) { var domObj = originalRequest.responseXML; alert(domObj); } This is all fired off via a body onload='update_parent' This works perfectly in Firefox. However, in IE8, it is failing with no errors. The alert in parent_response() does not get triggered in IE8. If I change the onComplete: to read : onComplete: parent_response() Then the alert triggers, but it pops up as undefined. How do I properly handle this so it works cross-browser? ie, what object should I be sending to get to the responseXML value? Thanks, -- --- Jason Frisvold xenopha...@gmail.com --- I love deadlines. I like the whooshing sound they make as they fly by. - Douglas Adams --~--~-~--~~~---~--~~ 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-scriptaculous@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 -~--~~~~--~~--~--~---
[Proto-Scripty] Re: Selectively prevent onClick action ?
david wrote: Sorry, I needed some more test, i did not use traditionnal event model: I'm not sure I understood the code you sent. Where does process() get called? I've put together a simple version of what I'm trying to do. Code follows: html head titleEvent Propagation/title script src=prototype.js type=text/javascript/script script type=text/javascript function showPopup() { alert('popup'); } function setRow() { alert('row'); } /script /head body div id='hoverdiv' style='display:none; position:absolute; top: 0; left:0;'/div div id='results' table border='1' thead tr thColumn 1/th thColumn 2/th thColumn 3/th /tr /thead tbody tr onclick='showPopup(this, 1)' tdRow 1-1/td tdRow 1-2/td td div id='row-1' a href='#' onclick='setRow()'Row 1-3/a /div /td /tr /tbody /table /div /body /html What I'm looking to do is fire showPopup() on a click inside the tr. However, if the a href is clicked instead, I want setRow() to fire, but not showPopup. Both of those functions will have Ajax.Updater calls in them, but I left them out for simplicity as I don't believe they have any bearing on this problem. I did some digging on stopPropagation and it looks like you can only use that on event handlers? How do I obtain a reference to the event handler? Thanks for your help thus far! -- david -- --- Jason Frisvold xenopha...@gmail.com --- I love deadlines. I like the whooshing sound they make as they fly by. - Douglas Adams --~--~-~--~~~---~--~~ 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-scriptaculous@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 -~--~~~~--~~--~--~---
[Proto-Scripty] Re: Selectively prevent onClick action ?
Alex Mcauley wrote: look at Event.stop(event) ... that will stop it bubbling up the DOM Excellent, thanks. but you need the event passed to the function That was the bit I was having a problem with, but I figured it out. I can pass the event itself via the function call. a href='#' onclick='setRow(event)'Row 1-3/a Once I had that, finishing the rest was easy.. HTH ALex Thanks for the help all! -- --- Jason Frisvold xenopha...@gmail.com --- I love deadlines. I like the whooshing sound they make as they fly by. - Douglas Adams --~--~-~--~~~---~--~~ 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-scriptaculous@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 -~--~~~~--~~--~--~---
[Proto-Scripty] Re: Another Prototype error?
Chris Sansom wrote: I keep getting a message I don't understand, and I can't even pin down exactly when it's happening. Every now and then Firebug tells me there's 1 error which, when I look at it, says: It appears not to have any adverse effect on the operation of what I'm doing - should I be concerned about this or just go on ignoring it as I have been? :-) Do you have any other tabs open, or maybe some extensions that gather remote info? Firebug console reports errors for other scripts in other tabs as well.. Might not even be related to what you're working on . -- --- Jason Frisvold xenopha...@gmail.com --- I love deadlines. I like the whooshing sound they make as they fly by. - Douglas Adams --~--~-~--~~~---~--~~ 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-scriptaculous@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 -~--~~~~--~~--~--~---
[Proto-Scripty] Re: Dimensions of dynamic content
T.J. Crowder wrote: Hi, Ajax.Updater is (by default) *asynchronous*, so your code doing the resizing runs before the request completes. Use an onSuccess handler [1] instead. (Don't just make the request synchronous, it locks up the browser UI.) You might also find the bulletproof ajax requests page[2] on the unofficial wiki useful. I actually tried onSuccess before, and had the same results. Is this the correct syntax? new Ajax.Updater('hoverdiv', 'getinfo.php?pass_id=' + passid, { method: 'get', onSuccess: function() { var myOff = myItem.cumulativeOffset(); var newX = myOff[0] + (myItem.getWidth() - myDiv.getWidth()) / 2; var newY = myOff[1] + (myItem.getHeight() - myDiv.getHeight()) / 2; myDiv.style.top = newY + 'px'; myDiv.style.left = newX + 'px'; myDiv.appear(); } }); Thanks for the link to the unofficial wiki, looks quite useful. HTH, -- T.J. Crowder tj / crowder software / com Independent Software Engineer, consulting services available -- --- Jason Frisvold xenopha...@gmail.com --- I love deadlines. I like the whooshing sound they make as they fly by. - Douglas Adams --~--~-~--~~~---~--~~ 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-scriptaculous@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 -~--~~~~--~~--~--~---
[Proto-Scripty] Re: Dimensions of dynamic content
Jason Frisvold wrote: I actually tried onSuccess before, and had the same results. Is this the correct syntax? onComplete makes this work properly. So, I wonder, if I properly check for failures, is it ok to use onComplete for this? -- --- Jason Frisvold xenopha...@gmail.com --- I love deadlines. I like the whooshing sound they make as they fly by. - Douglas Adams --~--~-~--~~~---~--~~ 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-scriptaculous@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 -~--~~~~--~~--~--~---
[Proto-Scripty] Re: Dimensions of dynamic content
Walter Lee Davis wrote: Aha. Try using onComplete. onSuccess fires when the Ajax event returns success (naturally) but before you've done anything in the local DOM with your new content. It's the Ajax equivalent of a 200 header from the browser. All it means is everything worked, now your content is coming! Yup, just realized this after I sent the previous message. Many thanks! Now I'm off to handle the failures and get this out the door! Walter -- --- Jason Frisvold xenopha...@gmail.com --- I love deadlines. I like the whooshing sound they make as they fly by. - Douglas Adams --~--~-~--~~~---~--~~ 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-scriptaculous@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 -~--~~~~--~~--~--~---
[Proto-Scripty] Selectively prevent onClick action ?
I'm not sure if this calls for a redesign, or if this is valid behavior. I have a table with an onClick action on the tr tags. Normally, I want this behavior to fire every time a row is clicked with one exception. Within the tr is an a href that triggers a different behavior on a click. At the moment, both behaviors fire simultaneously, both completing as they should. What I'd like to do is prevent the tr onclick from firing when I've specifically clicked on the a href. Is this possible? The code looks like this (using PHP smarty) : tr onclick='showPopup(this, {$row.id});' td{$row.vendor}/td td div id='trust-{$row.id}' img src='images/icon_thumbsup.gif' style='border: none' onclick='setTrust(1, {$row.id}, {$row.trust});' / {$row.trust} img src='images/icon_thumbsdown.gif' style='border: none' onclick='setTrust(0, {$row.id}, {$row.trust});' / /div /td /tr Both onclick functions are essentially ajax.updater functions with some scriptaculous effects thrown in for good measure. Thanks, -- --- Jason Frisvold xenopha...@gmail.com --- I love deadlines. I like the whooshing sound they make as they fly by. - Douglas Adams --~--~-~--~~~---~--~~ 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-scriptaculous@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 -~--~~~~--~~--~--~---