[Proto-Scripty] Re: Bug/Issue with autocompleter in IE7, first request doesn't appear, subsequent requests do

2008-11-18 Thread Joe Athman

We are having this exact same problem, although it only seemed to pop
up with version 1.8.2.  We have been using 1.8.1 just fine.  Does
anyone else see this?

Joe

On Nov 4, 4:28 pm, Tom <[EMAIL PROTECTED]> wrote:
> I have found an issue with theautocompleterin IE7 where the first
> issued requests doesn't appear in the drop down box while the second
> and subsequent requests do.  The first request does successfully issue
> the ajax request and gets a response, it just isn't displayed.
>
> This works fine in FF and Chrome.
>
> I'm using 1.8.1 of script.aculo.us
>
> IE 7.0.5730.13
>
> The demo on the website forautocompleterworks fine.
>
> Example code that doesn't work.  User enters a partial zipcode and
> gets back a list of matching zipcodes (+ city and state)
>
> 
>
> 
>    id="test_zip" value="">
>   Searching... span>
>   
> 
>
> 
>
>   new Ajax.Autocompleter("test_zip",
>                          "test_zip_choices",
>                          "../ajax/zip_list",
>                          {minChars: 3,
>                           paramName: "zip",
>                           indicator: "test_zip_indicator"});
>
> 
>
> 
>
> This is a sample response back for '024'.
>
> 
>
>  
>
>   02420   LEXINGTON,
> MA
>
>   02421   LEXINGTON,
> MA
>
>   02445   BROOKLINE,
> MA
>
>   02446   BROOKLINE,
> MA
>
>   02447   BROOKLINE
> VILLAGE, MA
>
>   02451   WALTHAM, MA span>
>
>   02452   WALTHAM, MA span>
>
>   02453   WALTHAM, MA span>
>
>   02454   WALTHAM, MA span>
>
>   02455   NORTH
> WALTHAM, MA
>
> 
>
> 
>
> The problem appears to be down in control.js.  Here is my work
> around / fix.  (478 is our internal subversion number for the original
> control.js).
>
> 
> ===
> --- controls.js (revision 478)
> +++ controls.js (working copy)
> @@ -65,11 +65,16 @@
>        function(element, update){
>          if(!update.style.position ||
> update.style.position=='absolute') {
>            update.style.position = 'absolute';
> +          try {
>            Position.clone(element, update, {
>              setHeight: false,
> -            offsetTop: element.offsetHeight
> -          });
> +                           offsetTop: element.offsetHeight});
> +          } catch (exception) {
> +            Position.clone(element, update, {
> +                           setHeight: false,
> +                           offsetTop: element.offsetHeight});
>          }
> +        }
>          Effect.Appear(update,{duration:0.15});
>        };
>      this.options.onHide = this.options.onHide ||
> 
>
> The first Position.clone call fails for some reason under IE7 while
> the second time it succeeds and the drop down complete box appears.
>
> If there is a better place to report or post this please let me know.
>
> Tom

--~--~-~--~~~---~--~~
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: Bug/Issue with autocompleter in IE7, first request doesn't appear, subsequent requests do

2008-11-20 Thread Joe Athman

I think I found closer to the root cause of the issue.  In
prototype.js I made a small change to getOffsetParent which fixed my
issue:
The line:
while ((element = element.parentNode) && element != document.body)

Becomes:
while ((element = element.parentNode) && element != document.body
&& element.style)


I'm not sure how or why, but somehow an element gets sent to this
method which does not have a style attribute.  The causes the line:
  if (Element.getStyle(element, 'position') != 'static')
To throw an exception.  I couldn't pinpoint what had changed in
prototype to cause this behavior.  We are using prototype 1.6.0.1 just
fine, but 1.6.0.3 on IE6 causes us problems here.  Does anyone else
have thoughts?

Joe


On Nov 18, 4:10 pm, Joe Athman <[EMAIL PROTECTED]> wrote:
> We are having this exact same problem, although it only seemed to pop
> up with version 1.8.2.  We have been using 1.8.1 just fine.  Does
> anyone else see this?
>
> Joe
>
> On Nov 4, 4:28 pm, Tom <[EMAIL PROTECTED]> wrote:
>
> > I have found an issue with theautocompleterin IE7 where the first
> > issued requests doesn't appear in the drop down box while the second
> > and subsequent requests do.  The first request does successfully issue
> > the ajax request and gets a response, it just isn't displayed.
>
> > This works fine in FF and Chrome.
>
> > I'm using 1.8.1 of script.aculo.us
>
> > IE 7.0.5730.13
>
> > The demo on the website forautocompleterworks fine.
>
> > Example code that doesn't work.  User enters a partial zipcode and
> > gets back a list of matching zipcodes (+ city and state)
>
> > 
>
> > 
> >    > id="test_zip" value="">
> >   Searching... > span>
> >   
> > 
>
> > 
>
> >   new Ajax.Autocompleter("test_zip",
> >                          "test_zip_choices",
> >                          "../ajax/zip_list",
> >                          {minChars: 3,
> >                           paramName: "zip",
> >                           indicator: "test_zip_indicator"});
>
> > 
>
> > 
>
> > This is a sample response back for '024'.
>
> > 
>
> >  
>
> >   02420   LEXINGTON,
> > MA
>
> >   02421   LEXINGTON,
> > MA
>
> >   02445   BROOKLINE,
> > MA
>
> >   02446   BROOKLINE,
> > MA
>
> >   02447   BROOKLINE
> > VILLAGE, MA
>
> >   02451   WALTHAM, MA > span>
>
> >   02452   WALTHAM, MA > span>
>
> >   02453   WALTHAM, MA > span>
>
> >   02454   WALTHAM, MA > span>
>
> >   02455   NORTH
> > WALTHAM, MA
>
> > 
>
> > 
>
> > The problem appears to be down in control.js.  Here is my work
> > around / fix.  (478 is our internal subversion number for the original
> > control.js).
>
> > 
> > ===
> > --- controls.js (revision 478)
> > +++ controls.js (working copy)
> > @@ -65,11 +65,16 @@
> >        function(element, update){
> >          if(!update.style.position ||
> > update.style.position=='absolute') {
> >            update.style.position = 'absolute';
> > +          try {
> >            Position.clone(element, update, {
> >              setHeight: false,
> > -            offsetTop: element.offsetHeight
> > -          });
> > +                           offsetTop: element.offsetHeight});
> > +          } catch (exception) {
> > +            Position.clone(element, update, {
> > +                           setHeight: false,
> > +                           offsetTop: element.offsetHeight});
> >          }
> > +        }
> >          Effect.Appear(update,{duration:0.15});
> >        };
> >      this.options.onHide = this.options.onHide ||
> > 
>
> > The first Position.clone call fails for some reason under IE7 while
> > the second time it succeeds and the drop down complete box appears.
>
> > If there is a better place to report or post this please let me know.
>
> > Tom

--~--~-~--~~~---~--~~
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.observer with mouseup?

2009-01-04 Thread Joe Athman

Another alternative is to use Prototype's Curry function which let's
you create new functions with default arguments.

So you could write:
Event.observe(window, 'mouseup', alert.curry('hi'));

Joe

As long as you know what curry does, I think this is more obvious for
really simple examples like this.

On Jan 3, 10:50 am, "T.J. Crowder"  wrote:
> > Also any reference to a function inside of an observer needs to be in
> > the form of an anonymous function, not a literal function itself.
>
> Doesn't have to be anonymous.  Named functions are fine:
>
> function myMouseUpThingy() {
>     alert('Howdy');
>
> }
>
> // later
>
> Event.observe(window, 'mouseup', myMouseUpThingy);
>
> The critical thing is that you need to pass in a function *reference*.
>
> -- T.J.
>
> On Jan 3, 4:45 pm, Walter Lee Davis  wrote:
>
> > Try doing this instead:
>
> > //put the following in a script block near the bottom of your html
> > var foo = function(){ alert('howdy') };
> > Event.observe(window,'mouseup',foo);
>
> > Note that the function is called Event.observe, not Event.observer.  
> > Also any reference to a function inside of an observer needs to be in  
> > the form of an anonymous function, not a literal function itself. You  
> > could have done this as well:
>
> > Event.observe(window,'mouseup',function(){alert('howdy')});
>
> > It's a subtle distinction, but it becomes much more important in a non-
> > trivial example, because an anonymous function won't get its input  
> > variables (and won't be called, either) until it is invoked. Then it  
> > "uncloaks", does its business, and vanishes again.
>
> > Walter
>
> > On Jan 2, 2009, at 1:30 PM, Per wrote:
>
> > > Hi,
> > > I'm new to protocoljs, but it's this thing I'm trying to do, and it
> > > doesn't work. It drives me mad.
>
> > > Anyway,
> > > I try to do this with protocoljs:
> > > 
>
> > > This was how I wrote it, but it doesn't work:
> > > Event.observer(window,'mouseup',alert('hi'));
>
> > > What is the right way to do it?
>
> > > Thank you!
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---