[Proto-Scripty] Re: Event.stop(event);

2009-07-29 Thread Alex McAuley

Thanks for the advice

Alex Mcauley
http://www.thevacancymarket.com
- Original Message - 
From: "Tobie Langel" 
To: "Prototype & script.aculo.us" 
Sent: Wednesday, July 29, 2009 2:28 PM
Subject: [Proto-Scripty] Re: Event.stop(event);


>
> For the sake of argument: http://gist.github.com/158165
>
> Turning the async option to false completely defeats the purpose and
> has tons of usability issues.
>
> I'd advise you to have a look at the linked code, research the methods
> name you don't know in the Prototype API and try to understand what it
> does.
>
> Good luck,
>
> Tobie
> >
> 


--~--~-~--~~~---~--~~
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: Event.stop(event);

2009-07-29 Thread Tobie Langel

For the sake of argument: http://gist.github.com/158165

Turning the async option to false completely defeats the purpose and
has tons of usability issues.

I'd advise you to have a look at the linked code, research the methods
name you don't know in the Prototype API and try to understand what it
does.

Good luck,

Tobie
--~--~-~--~~~---~--~~
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: Event.stop(event);

2009-07-29 Thread Alex McAuley

easier to leave it as it is (working) than add more lines of code.
Alex Mcauley
http://www.thevacancymarket.com
- Original Message - 
From: "Tobie Langel" 
To: "Prototype & script.aculo.us" 
Sent: Wednesday, July 29, 2009 1:45 PM
Subject: [Proto-Scripty] Re: Event.stop(event);


>
>> Found an easier way
>>
>> Added "asyncronous: false," to the ajax options!!
>
> That's no longer ajax, then. ;)
>
> The way to handle this issue is to:
>
> 1. stop the event immediately.
> 2. in case of an ajax failure, just change window.location to $
> (this).readAttribute('href');
>
> Also, you should consider suing event delegation in such a case.
>
> Best,
>
> Tobie
>
> >
> 


--~--~-~--~~~---~--~~
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: Event.stop(event);

2009-07-29 Thread Tobie Langel

> Found an easier way
>
> Added "asyncronous: false," to the ajax options!!

That's no longer ajax, then. ;)

The way to handle this issue is to:

1. stop the event immediately.
2. in case of an ajax failure, just change window.location to $
(this).readAttribute('href');

Also, you should consider suing event delegation in such a case.

Best,

Tobie

--~--~-~--~~~---~--~~
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: Event.stop(event);

2009-07-29 Thread Alex McAuley

Found an easier way

Added "asyncronous: false," to the ajax options!!

Thanks for input


Alex Mcauley
http://www.thevacancymarket.com
- Original Message - 
From: "Daniel Rubin" 
To: 
Sent: Wednesday, July 29, 2009 12:33 PM
Subject: [Proto-Scripty] Re: Event.stop(event);


>
> Jeztah wrote:
>> Morning guys/gals.
>>
>> I have some weird behaviour regarding Event.stop();
>>
>> $$('.quickdetails').invoke('observe','click',function(event) {
>>
>>
>> var this_href=$(this).readAttribute('href');
>> var element=this;
>> var arr=this_href.split("/");
>> if(arr.length<3) { return; }
>> var vacancy_id=arr[arr.length-1];
>>
>> window.eEvent=event;
>>
>> var request=new Ajax.Request('/VacancyInfo',{
>> evalScripts: true,
>> method: 'get',
>> parameters:
>> {
>> id:vacancy_id
>> },
>> onSuccess : function(transport) {
>>
>>
>> var text=transport.responseText;
>>
>> $modals.showVacancy({string:text,node:element});
>>
>> Event.stop(window.eEvent); // doesnt stop it
>> Event.stop(event); // doesnt also stop
>> the event
>> },
>> onError : function() {
>> return true;
>> }
>> });
>> request=null;
>> //Event.stop(event); // stops it
>> });
>> });
>>
>> 
>>
>> Would it be better to set a variable in the "onSuccess" and then query
>> the variable after the Ajax.Request ? as calling Event.stop() inside
>> the handler does not seem to work on any browser ?
>>
>> Regards
>> Alex
> "After the AJAX request", in terms of lines of code, is not the same as
> it is in terms of execution time.  In fact, if you'd put the
> Event.stop() after the Ajax.Request instantiation, it would get executed
> earlier than then onSuccess handler function (which is executed
> asynchronously).
>
> So, what goes wrong in the case given is that the Event.stop(event) (in
> the onSuccess handler) is called later, when the event has spent its
> whole lifetime (and has triggered any other handlers observing on
> elements above the clicked quickdetails element, as well as the default
> action).
>
> This is a tricky case.  If you really must stick with the click event
> (e. g. there might be some other handlers that are not under your
> control), I'd suggest to stop() the original event in any case, so no
> further handlers are triggered.  Then, if the AJAX call should fail,
> clone the event and re-issue it.  (I gather Element.fire() doesn't help
> you with that, so some browser-dependent magic would have to be worked.)
> Otherwise, if you're only interested in switching to the href URL of the
> clicked link, it's probably easiest to set window.location.href in the
> AJAX call's onError handler.
>
> Hope that's useful
> Daniel
>
> >
> 


--~--~-~--~~~---~--~~
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: Event.stop(event);

2009-07-29 Thread Daniel Rubin

Jeztah wrote:
> Morning guys/gals.
> 
> I have some weird behaviour regarding Event.stop();
> 
> $$('.quickdetails').invoke('observe','click',function(event) {
> 
> 
>   var this_href=$(this).readAttribute('href');
>   var element=this;
>   var arr=this_href.split("/");
>   if(arr.length<3) { return; }
>   var vacancy_id=arr[arr.length-1];
> 
>   window.eEvent=event;
> 
>   var request=new Ajax.Request('/VacancyInfo',{
>   evalScripts:true,
>   method: 'get',
>   parameters:
>   {
>   id:vacancy_id
>   },
>   onSuccess : function(transport) {
> 
> 
>   var text=transport.responseText;
> 
>   
> $modals.showVacancy({string:text,node:element});
> 
>   Event.stop(window.eEvent); // doesnt stop it
> Event.stop(event); // doesnt also stop
> the event
>   },
>   onError : function() {
>   return true;
>   }
>   });
>   request=null;
>   //Event.stop(event); // stops it
>   });
> });
> 
> 
> 
> Would it be better to set a variable in the "onSuccess" and then query
> the variable after the Ajax.Request ? as calling Event.stop() inside
> the handler does not seem to work on any browser ?
> 
> Regards
> Alex
"After the AJAX request", in terms of lines of code, is not the same as
it is in terms of execution time.  In fact, if you'd put the
Event.stop() after the Ajax.Request instantiation, it would get executed
earlier than then onSuccess handler function (which is executed
asynchronously).

So, what goes wrong in the case given is that the Event.stop(event) (in
the onSuccess handler) is called later, when the event has spent its
whole lifetime (and has triggered any other handlers observing on
elements above the clicked quickdetails element, as well as the default
action).

This is a tricky case.  If you really must stick with the click event
(e. g. there might be some other handlers that are not under your
control), I'd suggest to stop() the original event in any case, so no
further handlers are triggered.  Then, if the AJAX call should fail,
clone the event and re-issue it.  (I gather Element.fire() doesn't help
you with that, so some browser-dependent magic would have to be worked.)
Otherwise, if you're only interested in switching to the href URL of the
clicked link, it's probably easiest to set window.location.href in the
AJAX call's onError handler.

Hope that's useful
Daniel

--~--~-~--~~~---~--~~
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: Event.stop(event);

2009-07-29 Thread Alex McAuley

I should add

the bottom Event.stop(event); after the ajax request is not an option as i 
dont want it stopped there incase somethign went wrong in the request - i 
would like the click to follow the href and work as normal.

Alex Mcauley
http://www.thevacancymarket.com
- Original Message - 
From: "Jeztah" 
To: "Prototype & script.aculo.us" 
Sent: Wednesday, July 29, 2009 12:08 PM
Subject: [Proto-Scripty] Event.stop(event);


>
> Morning guys/gals.
>
> I have some weird behaviour regarding Event.stop();
>
> $$('.quickdetails').invoke('observe','click',function(event) {
>
>
> var this_href=$(this).readAttribute('href');
> var element=this;
> var arr=this_href.split("/");
> if(arr.length<3) { return; }
> var vacancy_id=arr[arr.length-1];
>
> window.eEvent=event;
>
> var request=new Ajax.Request('/VacancyInfo',{
> evalScripts: true,
> method: 'get',
> parameters:
> {
> id:vacancy_id
> },
> onSuccess : function(transport) {
>
>
> var text=transport.responseText;
>
> $modals.showVacancy({string:text,node:element});
>
> Event.stop(window.eEvent); // doesnt stop it
>Event.stop(event); // doesnt also stop
> the event
> },
> onError : function() {
> return true;
> }
> });
> request=null;
> //Event.stop(event); // stops it
> });
> });
>
> 
>
> Would it be better to set a variable in the "onSuccess" and then query
> the variable after the Ajax.Request ? as calling Event.stop() inside
> the handler does not seem to work on any browser ?
>
> Regards
> Alex
>
> >
> 


--~--~-~--~~~---~--~~
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: Event.stop(event) FF Issue

2009-02-10 Thread Alex Mcauley

event.preventDefault();

or

return false;


- Original Message - 
From: "cyrusdev08" 
To: "Prototype & script.aculo.us" 
Sent: Tuesday, February 10, 2009 7:00 AM
Subject: [Proto-Scripty] Event.stop(event) FF Issue


>
> Hello Every One
>
> I have one issue for Firefox
>
> I want to stop the form from being submitted , I used >> Event.stop
> (event);  ,
>
> it works fine in IE but not working FF
>
> please help me..
>
>
> thanks
>
> >
> 


--~--~-~--~~~---~--~~
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: Event.stop(event) and IE7

2008-09-17 Thread kukipei

In IE7 with Event.stop(event);  I can not stop propagation for any
key. It is look like It doesn't work for keyup event
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: Event.stop(event) and IE7

2008-09-17 Thread bluezehn

Does it stop propagation of other keys? If so I doubt there's much you
can do about this. Maybe IE instantly fires two events - one on the
specific element which bubbles up and another straight to IE itself.
I'd say it would be confusing to users to alter the action of the alt
key anyway. If I used the alt key regularly to access the file menu
then you stopped it from doing that, that would get me pissed with
your website. Sorry if that's not particularly what you wanted to
hear...

On Sep 16, 10:40 pm, kukipei <[EMAIL PROTECTED]> wrote:
> Hi to all,
>
> I want to stop propagation of alt keyup event.
> This is a part of the code:
>
> Event.observe(document, 'keyup', function(event)
> {
> Event.stop(event);
>         if (event.keyCode == 18)//alt key
>         {
>                 if($('temp_1_2').disabled == false)
>                 {
>                         if (pointerForSmoke == 0)
>                         {
>                                 set_crack_s1($('first_smoke'));
>                                 pointerForSmoke++;
>                         }
>                         else if(pointerForSmoke == 1) .
>
> It works fine with ff3 and safari, but it is nor working with IE7.
> When I press alt key it selects file button in menu bar. How can I
> override this.
> I am using prototype 1.6.
>
> Best Regards,
> Predrag
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---