[Proto-Scripty] Re: HTTP OPTION REQUEST with FireFox 3.5

2009-08-05 Thread Alex McAuley
Walter... The link in his post describes how to do XDR in FF3.5! Alex Mcauley http://www.thevacancymarket.com - Original Message - From: "Walter Lee Davis" To: Sent: Thursday, August 06, 2009 6:27 AM Subject: [Proto-Scripty] Re: HTTP OPTION REQUEST with FireFox 3.5 > > Unless you wo

[Proto-Scripty] Re: How to catch/prevent onclick event?

2009-08-05 Thread T.J. Crowder
Hi, One of the few good things about those old-style handlers is that they're attributes, so finding the links is easy: var hookedlinks = $$('a[onclick]'); Then if your goal is to remove the handler: var n; for (n = hookedlinks.length - 1; n >= 0; --n) { hookedlinks[n].onclick = null; } O

[Proto-Scripty] Re: HTTP OPTION REQUEST with FireFox 3.5

2009-08-05 Thread Walter Lee Davis
Unless you work at Twitter, this will run afoul of the Single Origin Policy, and you can't do this. (Ajax requests have to stick to the domain and port that they are run from for their content.) If you create a simple proxy and run it on your server, then you could request /mytwitterproxy.

[Proto-Scripty] Re: How to catch/prevent onclick event?

2009-08-05 Thread Walter Lee Davis
Best to try removing those at dom:loaded, maybe with something like this: document.observe('dom:loaded',function(){ $$(a).each(function(elm){elm.onclick = null}); }); That's just a guess... But as far as I know, you can't stop these inline event handlers any other way. Walter On A

[Proto-Scripty] function in prototype

2009-08-05 Thread Valentino
Dear all I am new to javascript and prototype. I have difficulty in writing function() in prototype because I am confused that function can be one of the parameter..i.e. some_function(abc, function()) I have the following code, the two observe functions actually doing the same thing, only with d

[Proto-Scripty] HTTP OPTION REQUEST with FireFox 3.5

2009-08-05 Thread 0m4r
Hi All, I have a strange behavior with a pice of code I wrote using the latest prototype release, here it is: == var debug = $('debug'); new Ajax.Request("http://twitter.com/statuses/ public_timeline.json", { method: 'get', onLoading: function(){ de

[Proto-Scripty] How to catch/prevent onclick event?

2009-08-05 Thread Hipnotik
Hi I have observer set for the whole document to catch click events on links (a href) and prevent default action (open page from href, event.stop). It works correct, but ... now I have onclick event defined inside of each a-herf element and I need to catch/prevent this event too. How to do that? I

[Proto-Scripty] Re: Beginners question, trouble with Event.stop in AJAX

2009-08-05 Thread DJ Mangus
I honestly think the defer is best at this point as oncomplete occurs even on failed requests. Your choices are to rewrite your own stuff instead of prototype functions (ie. Do your own success checks or do your own updating) or just stick with defer. On 8/5/09, Ash wrote: > > Do you mean to use

[Proto-Scripty] Re: Beginners question, trouble with Event.stop in AJAX

2009-08-05 Thread Ash
Do you mean to use function callProcBasketEmail(e) { var pars = Form.serialize('email-form'); var myAjax = new Ajax.Updater('email-response', 'procBasketEmail.php', { method: 'post', parameters: pars, onComplete: function(response) { Event.obser

[Proto-Scripty] Re: Beginners question, trouble with Event.stop in AJAX

2009-08-05 Thread DJ Mangus
OK, just checked the source. onComplete is where ajax.updater actually updates the node. onSuccess is called before that. Workaround is to either a.) use defer like you did, or b.) use Ajax.request and update it yourself onSuccess, then do your Event.observe. Plusses of option b is that it won'

[Proto-Scripty] Re: Browser scroller position after Ajax.Update

2009-08-05 Thread DJ Mangus
pretty much yes but some shut it off for security reasons On Wed, Aug 5, 2009 at 3:01 PM, DJJQ wrote: > > Ok. I thought everyone had javscript by now :) > > On Aug 5, 11:39 pm, DJ Mangus wrote: >> The only problem with that solution is you provide no degradation to >> people without javascript.

[Proto-Scripty] Re: Beginners question, trouble with Event.stop in AJAX

2009-08-05 Thread Ash
I wonder why in this case, that onSuccess is executed before the DOM node has been created. Using a hack is okay to get me up and running but I would like to know how to use ajax methods correctly On Aug 5, 10:48 pm, DJ Mangus wrote: > yes but onSuccess shouldn't be called until after the ajax.

[Proto-Scripty] Re: Class with Ajax and onclick event

2009-08-05 Thread Liviu Timar
I figured it out. I understand that the extra argument will be null because it doesn't exist when the link is being clicked. The solution I found was to make my own attribute "count" for the element: . This attribute can be read by using readAttribute in the changeContent function. After I will

[Proto-Scripty] Re: Browser scroller position after Ajax.Update

2009-08-05 Thread DJJQ
Ok. I thought everyone had javscript by now :) On Aug 5, 11:39 pm, DJ Mangus wrote: > The only problem with that solution is you provide no degradation to > people without javascript. > > On 8/5/09, DJJQ wrote: > > > > > > > > > Thank you for your solution, but instead I changed to > href="ja

[Proto-Scripty] Re: Beginners question, trouble with Event.stop in AJAX

2009-08-05 Thread DJ Mangus
yes but onSuccess shouldn't be called until after the ajax.updater is completed. Therefore the DOM node should be available at that point. On Wed, Aug 5, 2009 at 2:40 PM, Alex McAuley wrote: > > Ajax is Asyncronous so it gets  executed along with other script ... > ergo its not serial like php a

[Proto-Scripty] Re: Beginners question, trouble with Event.stop in AJAX

2009-08-05 Thread Alex McAuley
Ajax is Asyncronous so it gets executed along with other script ... ergo its not serial like php and other stuff your prolly used to... you can make a request synconous (script waits for the ajax request to finish before continuing but its not recommended Alex Mcauley http://www.thevacancymark

[Proto-Scripty] Re: Beginners question, trouble with Event.stop in AJAX

2009-08-05 Thread DJ Mangus
Kind of a hack but function.defer is useful in many other contexts. On 8/5/09, Ash wrote: > > That seems to be working! > > Is Event.observe.defer a standard method, or is it only to be used in > certain cases? > > I'm happy that it's working but I would really like to learn the > basics properl

[Proto-Scripty] Re: Browser scroller position after Ajax.Update

2009-08-05 Thread DJ Mangus
The only problem with that solution is you provide no degradation to people without javascript. On 8/5/09, DJJQ wrote: > > Thank you for your solution, but instead I changed to href="javascript:null()"> and it works like a charm. > > On Aug 5, 11:00 pm, "Alex McAuley" > wrote: >> Nope... >> >

[Proto-Scripty] Re: Beginners question, trouble with Event.stop in AJAX

2009-08-05 Thread Ash
That seems to be working! Is Event.observe.defer a standard method, or is it only to be used in certain cases? I'm happy that it's working but I would really like to learn the basics properly. Thanks anyway for getting me up and running! Ashley On Aug 5, 10:32 pm, DJ Mangus wrote: > good ques

[Proto-Scripty] Re: Browser scroller position after Ajax.Update

2009-08-05 Thread DJJQ
Thank you for your solution, but instead I changed to and it works like a charm. On Aug 5, 11:00 pm, "Alex McAuley" wrote: > Nope... > > If you are observing the click with observe() >  just call Event.stop(event); on it > > Example. > > $('myHref').observe('click',function(event) { > Event.st

[Proto-Scripty] Re: Beginners question, trouble with Event.stop in AJAX

2009-08-05 Thread DJ Mangus
good question. You might change Event.observe( . . . etc to Event.observe.defer( . . . and see if that fixes it. Odd that the node isn't available in the DOM at onSuccess but that might work around it while I research. On Wed, Aug 5, 2009 at 2:22 PM, Ash wrote: > > yes, when I check the HTML t

[Proto-Scripty] Re: Beginners question, trouble with Event.stop in AJAX

2009-08-05 Thread Ash
yes, when I check the HTML tab, the form with the id=password-form has not been created within the email-response div, even though I have waited to check for it with the onSuccess line EG function callProcBasketEmail(e) { var pars = Form.serialize('email-form'); var myAjax = new Ajax.Upd

[Proto-Scripty] Re: Beginners question, trouble with Event.stop in AJAX

2009-08-05 Thread DJ Mangus
actually just checked firebug, best place would be html tab. DOM tab lists the entire DOM which would be very hard to go through. On Wed, Aug 5, 2009 at 2:12 PM, Ash wrote: > > Sorry, i'm quite new to this, should I be looking for the form > id=password-form element in the DOM, not sure where to

[Proto-Scripty] Re: Beginners question, trouble with Event.stop in AJAX

2009-08-05 Thread Ash
Sorry, i'm quite new to this, should I be looking for the form id=password-form element in the DOM, not sure where to look for it in the DOM tab of firebug? Is this correct? On Aug 5, 10:06 pm, DJ Mangus wrote: > when Firebug breaks on the error, check the DOM tab to see the > state at that pa

[Proto-Scripty] Re: Beginners question, trouble with Event.stop in AJAX

2009-08-05 Thread DJ Mangus
when Firebug breaks on the error, check the DOM tab to see the state at that particular moment. On Wed, Aug 5, 2009 at 2:05 PM, Alex McAuley wrote: > > Seems the element does not exist... > > Does it exist in the DOM ? > > > Alex Mcauley > http://www.thevacancymarket.com > - Original Message

[Proto-Scripty] Re: Beginners question, trouble with Event.stop in AJAX

2009-08-05 Thread Alex McAuley
Seems the element does not exist... Does it exist in the DOM ? Alex Mcauley http://www.thevacancymarket.com - Original Message - From: "Ash" To: "Prototype & script.aculo.us" Sent: Wednesday, August 05, 2009 10:04 PM Subject: [Proto-Scripty] Re: Beginners question, trouble with Event

[Proto-Scripty] Re: Beginners question, trouble with Event.stop in AJAX

2009-08-05 Thread Ash
When I set firebug to break on all errors... Submit the first form and I get (from prototype.js) function getEventID(element) { element is null3936 if (element._prototypeEventID) return element._prototypeEventID[0]; (element is null error) if I step past it and submit the second form I get the

[Proto-Scripty] Re: Browser scroller position after Ajax.Update

2009-08-05 Thread Alex McAuley
Nope... If you are observing the click with observe() just call Event.stop(event); on it Example. $('myHref').observe('click',function(event) { Event.stop(event); Your ajax code here. }); That way it will degrade in browsers not having javascript and they will just goto the href of

[Proto-Scripty] Re: Class with Ajax and onclick event

2009-08-05 Thread Liviu Timar
Sorry, I forgot to specify. This is the code: getContent: function() { var dyn = this; new Ajax.Request(this.script, { onSuccess: function(req) { dyn.content = req.respo

[Proto-Scripty] Re: Browser scroller position after Ajax.Update

2009-08-05 Thread DJJQ
Yes that's right. Maybe that's the problem, should I javascript:null it? On Aug 5, 10:40 pm, "Alex McAuley" wrote: > what does the link look like ? > > Click me > > Like that ? > > Alex Mcauleyhttp://www.thevacancymarket.com > > > > - Original Message - > From: "DJJQ" > To: "Prototype &

[Proto-Scripty] Re: Browser scroller position after Ajax.Update

2009-08-05 Thread Alex McAuley
what does the link look like ? Click me Like that ? Alex Mcauley http://www.thevacancymarket.com - Original Message - From: "DJJQ" To: "Prototype & script.aculo.us" Sent: Wednesday, August 05, 2009 9:33 PM Subject: [Proto-Scripty] Re: Browser scroller position after Ajax.Update

[Proto-Scripty] Re: Beginners question, trouble with Event.stop in AJAX

2009-08-05 Thread DJ Mangus
Are you getting any Javascript errors? Note: firefox and firebug is your friend. Don't forget to break on all errors. On Wed, Aug 5, 2009 at 11:22 AM, Ash wrote: > > Hi, I wasn't sure whether you meant in the 1st or second function, but > it doesn't make a difference in either. > > I think it is

[Proto-Scripty] Re: Browser scroller position after Ajax.Update

2009-08-05 Thread DJ Mangus
Maybe this might help. http://www.prototypejs.org/api/element/scrollto On Wed, Aug 5, 2009 at 1:33 PM, DJJQ wrote: > > Oh my god my english was terrible in my post, sorry about that. > I'll try to explain the problem again: > On my php page I have a link a long way down the page, so users have >

[Proto-Scripty] Re: Browser scroller position after Ajax.Update

2009-08-05 Thread DJJQ
Oh my god my english was terrible in my post, sorry about that. I'll try to explain the problem again: On my php page I have a link a long way down the page, so users have to scroll down a bit. the link triggers an ajax.update on the page. When users press the link the browser returns to the top o

[Proto-Scripty] Re: Browser scroller position after Ajax.Update

2009-08-05 Thread Alex McAuley
Can you explain it a bit better please... i cant really understand what you mean by that Thanks Alex Mcauley http://www.thevacancymarket.com - Original Message - From: "DJJQ" To: "Prototype & script.aculo.us" Sent: Wednesday, August 05, 2009 8:22 PM Subject: [Proto-Scripty] Browser s

[Proto-Scripty] Browser scroller position after Ajax.Update

2009-08-05 Thread DJJQ
Hello. My problem when is apparent on my page. The div to be updated (and link) are a long way down the page so users have to scroll down. When they press the link and thus update the div the browsers scroller returns to top, forcing the user to scroll down again to the div. Is there any "quickfix

[Proto-Scripty] Re: Beginners question, trouble with Event.stop in AJAX

2009-08-05 Thread Ash
Hi, I wasn't sure whether you meant in the 1st or second function, but it doesn't make a difference in either. I think it is the Event.observe('password-form', 'submit', callProcBasketPassword); which is not working properly, although I don't know how to debug it On Aug 5, 6:48 pm, DJ Mangus w

[Proto-Scripty] Re: Beginners question, trouble with Event.stop in AJAX

2009-08-05 Thread DJ Mangus
Try adding e.preventDefault(); instead of Event.stop(e) and let me know if that works? On Tue, Aug 4, 2009 at 4:55 PM, Ash wrote: > function callProcBasketEmail(e) { >    var pars = Form.serialize('email-form'); >    var myAjax = new Ajax.Updater('email-response', > 'procBasketEmail.php', { >    

[Proto-Scripty] Re: Class with Ajax and onclick event

2009-08-05 Thread Matt Foster
Depending on when you wanted to pass the additional argument you could just attach it to the argument chain on bind this.changeContent = this.changeContent.bindAsEventListener(this, extraArgument); Since we're already looking at that line of code, be careful, reassigning the function to a bound

[Proto-Scripty] Ajax.Responders issues

2009-08-05 Thread Eric
Hi, I am trying to setup some basic Ajax framework, and I was thinking to use Ajax.Responders to intercept some events, but I meet the following issues : - First, it seems that the responders ignore an onSuccess() callback passed through Ajax.Responders.register(). This may be a documentation err

[Proto-Scripty] Re: Using a prototype function in dynamic content.

2009-08-05 Thread Drum
> >     $(div).update(thereturn); > That did the trick! It's true that I don't make as much use of prototype as I could or should. Most of the js/ajax on the site is written from scratch (way back when I was learning how to use ajax). I added prototype later on to do some of the 'bells and whist

[Proto-Scripty] Re: Class with Ajax and onclick event

2009-08-05 Thread Liviu Timar
Thank you for the response. You're right, I declared another variable and now it works fine. I have two other problems, though: I can't pass an aditional argument to the event handler(changeContent) and I can't figure out how can I make the content change automatic... On Aug 5, 11:33 am, ColinFin

[Proto-Scripty] Re: Class with Ajax and onclick event

2009-08-05 Thread ColinFine
On Aug 4, 2:24 pm, Liviu Timar wrote: > var Dynamic = Class.create({ >         initialize: function(selector, container, script) >         { >                 this.selector  = selector; >                 this.script    = script; >                 this.container = container; > >