[Proto-Scripty] Re: Odd behaviour with chained calls.

2009-02-17 Thread Richard Quadling

2009/2/16 kangax kan...@gmail.com:

 On Feb 16, 11:10 am, Richard Quadling rquadl...@googlemail.com
 wrote:
 Hi.

 I want to set an error message for 20 seconds ...

 $('sessionError').update(o_E.responseText).show().hide.delay(20);

 The message is displayed correctly.

 But not hidden again after 20 seconds or so.

 Instead, I'm getting an error ...

 element.style is undefined.

 If I ...

 $('sessionError').update('An error').show().hide(20);

 at the command prompt in FB, then no problems.

 It seems delay is not working as I would expect.

 If I ...

 $('sessionError').update('An error').show().hide.delay(20);

 at the command prompt I get a number which I assume is the id of the
 timer so I can cancel it.

 Example online (requires a javascript console).

 Go tohttp://www.prototypejs.organd enter the following code into
 your javascript console.

 $('header').update('Prototype is quite good!').show().hide.delay(2)

 You will see the timer ID (4 in my case) and then the error message
 (after a little while).

  $('header').update('Prototype is quite good!').show().hide.delay(2)

 4
 $(element).style is undefined
 [Break on this error] $(element).style.display = 'none';
 prototype.js (line 1349)


 The problem is that `hide` is not being called in a context of an
 element (but rather in a context of what `delay` specifies, which is a
 `hide` function itself). You can work around it by binding `hide` to
 `el` - in other words, making sure `hide` is to be called in a context
 of `el`:

 var el = $('header');
 el.update('Prototype is quite good!').show();
 el.hide.bind(el).delay(2);

 Even better, you can take advantage of `delay` being able to `curry`
 arguments of a reciever function:

 var el = $('header');
 el.update('Prototype is quite good!').show();
 Element.hide.delay(2, el);

 You can of course shorten it up further to something like:

 Element.hide.delay(2, $('header').update('Prototype is quite
 good!').show());

 but I wouldn't, as it becomes rather cryptic : )

 --
 kangax
 


Ah. I keep thinking ...

Element.hide(el);

is the same as

el.hide();


That's where I've gone wrong.

I think.






-- 
-
Richard Quadling
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498r=213474731
Standing on the shoulders of some very clever giants!

--~--~-~--~~~---~--~~
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] Ajax.Autocompleter

2009-02-17 Thread Craig

Am having one problem i cannot seem to solve. The autocompleter box
displays the results which has a set height so a scroll bar displays.
In FF but not other browsers when you scroll through the results it
works fine but in any other browser it will just lose focus and
disappear.

Anyone come accross the same problem have a fix? Am using the latest
versions.
--~--~-~--~~~---~--~~
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: weird grey submits error

2009-02-17 Thread fREW Schmidt
 Hello Javascript friends!

 I am working on a fairly simple javascript issue and I can't seem to figure
 out what is going wrong.  I have tried two setups, both of which don't
 work.  The simpler is this:

 In our html we have a form and in the form tag we add an
 onsubmit=greySubmits() attribute.  This is the greySubmits function.

 function greySubmits() {
   $$(input[type='submit']).each(function(e){e.disable()})
 }


 I also tried to add this to our javascript and remove the onsubmit tag from
 our html:

   Event.observe(window, 'load', function() {
   $$(input[type='submit']).each(function(e) {
   Event.observe(e, 'click', greySubmits);
   });
 });

 The problem is that one way or the other, when we do this for some reason
 the javascript does not set along the value of the button that was clicked.
 This means that the preview button no longer works as we check the value of
 the submit button field for that.  Any idea what we are doing wrong here?

 Thanks!


I ended up doing this.  Let me know if there is a better way:

function greySubmits(e) {
  // First replace the button so that the correct commit will get sent
  var value = e.currentTarget.defaultValue;
  $(e.currentTarget).insert('input type=hidden name=commit value=' +
value +' /');

  // Then disable buttons so people can't double post
  $$(input[type='submit']).each(function(e){e.disabled = true;})
}


Event.observe(window, 'load', function() {
$$(input[type='submit']).each(function(e) {
Event.observe(e, 'click', greySubmits);
  });
  });



-- 
fREW Schmidt
http://blog.afoolishmanifesto.com

--~--~-~--~~~---~--~~
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] weird grey submits error

2009-02-17 Thread fREW Schmidt
Hello Javascript friends!

I am working on a fairly simple javascript issue and I can't seem to figure
out what is going wrong.  I have tried two setups, both of which don't
work.  The simpler is this:

In our html we have a form and in the form tag we add an
onsubmit=greySubmits() attribute.  This is the greySubmits function.

function greySubmits() {
  $$(input[type='submit']).each(function(e){e.disable()})
}


I also tried to add this to our javascript and remove the onsubmit tag from
our html:

  Event.observe(window, 'load', function() {
  $$(input[type='submit']).each(function(e) {
  Event.observe(e, 'click', greySubmits);
  });
});

The problem is that one way or the other, when we do this for some reason
the javascript does not set along the value of the button that was clicked.
This means that the preview button no longer works as we check the value of
the submit button field for that.  Any idea what we are doing wrong here?

Thanks!

-- 
fREW Schmidt
http://blog.afoolishmanifesto.com

--~--~-~--~~~---~--~~
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] Multiple droppables in overflowed div!

2009-02-17 Thread javamaasai

Hey All,

I'm creating a small online traditional Shop, where tourists can buy
African traditional goods. These include things like beads, Warrior
spears clothing e.t.c My web application has pictures of african items
draggables in an overflowed div and droppables pictures of visit
locations where one.

Issue is when multiple droppables are put in overflowed div and
scrolled, they kind of virtually remain fixed, i.e. droppable3 scrolls
to position of droppable1 but on dropping on droppable3 the active
drop area is for droppable1!

Here is small sample code test code:

!DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Strict//EN http://
www.w3.org/TR/xhtml1/DTD/...
html xmlns=http://www.w3.org/1999/xhtml;
head
script src=javascript/prototype.js type=text/javascript
script src=javascript/scriptaculous.js type=text/
javascript
/script
/head
body
style type=text/css

div#droppable_container {
margin-bottom: 30px;
height: 300px;
width: 500px;
background: black;
padding: 10px;
}

div#droppable_demo {
width: 160px;
height: 120px;
font-size: 15px;
background: #ff;
border: 5px solid #ccc;
text-align: center;
float: right;
}

.droppable_demo {
width: 100px;
height: 100px;
font-size: 15px;
background: #ff;
border: 5px solid #ccc;
text-align: center;
float: left;
margin: 5px;
}

#draggable_demo {
background: yellowgreen;
margin: 5px;
border: 3px solid green;
width: 100px;
height: 100px;
cursor: move;
font-size: 15px;
float: left;
}

.spaceHolder {
background: orange;
margin: 5px;
border: 3px solid orangered;
width: 100px;
height: 100px;
font-size: 15px;
float: left;
}

div#droppable_demo.hover {
border: 5px dashed orange;
background: #efefef;
}
.droppable_demo.hover {
border: 5px dashed orange;
background: #efefef;
}

#dragContainer {
background: yellow;
border: 5px solid blue;
float: left;
width: 60%;
height: 120px;
overflow: auto; /*This is where the weirdness
happens*/
}
#dropContainer {
background: blue;
border: 5px solid red;
float: left;
width: 60%;
height: 120px;
overflow: auto; /*This is where the weirdness
happens*/
}

h3 {
color: black;
float: left;
}
/style
div id=droppable_container
div id=dragContainer
div class=draggable id=draggable_demo
DRAG ME!!!
/div
!-- space holders added to create overflow --
div class=spaceHolder
Space Holder
/div
div class=spaceHolder
Space Holder
/div
div class=spaceHolder
Space Holder
/div
/div
div id=dropContainer
div class=droppable_demo id=droppable_demo1
Drop here1!
/div
!-- space holders added to create overflow --
div class=droppable_demo id=droppable_demo2
Drop here2!
/div
div class=droppable_demo id=droppable_demo3
Drop here3!
/div
div class=droppable_demo id=droppable_demo4
Drop here4!
/div
/div
/div

h3Draggables in yellow container with blue border,
droppables in blue containter with red border. Drag green box to Drop
here 1, it will change bourder on hover. Then scroll the droppables in
blue until you can see half-botttom of Drop here 1  Drop here 2 and
the last two Drop here 3  4./h3
script type=text/javascript
new Draggable('draggable_demo', {
revert: true,
ghosting: true // this is needed to avoid the
craziness of the overflowed div's scroll bars
});

for (var i = 1; i = 4; i++) {
  

[Proto-Scripty] Re: Odd behaviour with chained calls.

2009-02-17 Thread Daniel Rubin
Richard Quadling wrote:
 Hi.
 
 I want to set an error message for 20 seconds ...
 
 $('sessionError').update(o_E.responseText).show().hide.delay(20);
 
 The message is displayed correctly.
 
 But not hidden again after 20 seconds or so.
It's because you lose the scope of the $('sessionError') Element when 
you get the hide-method.  You're back in the calling scope, which 
doesn't seem to be an Element, so that's why there's no style-property.
This works:
   $('sessionError').update(o_E.responseText).show()
 .hide.bind($('sessionError')).delay(20);
But the chaining doesn't really make sense any more.

I think it could best be solved like this:
   $('sessionError').update(o_E.responseText).show();
   (function () { $('sessionError').hide (); }).delay (20:

Have fun
Daniel



-- 
Daniel Rubin  dru...@dimedis.de
dimedis GmbH  www.dimedis.de
Dillenburger Strasse 83   0221/921260-44 (-59,Fax)
51105 Koeln   Software Entwicklung
HRB Köln 51787Geschäftsführer: Dipl.-Ing. W. Halling

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---

begin:vcard
fn:Daniel Rubin
n:Rubin;Daniel
org:dimedis GmbH;Software Entwicklung
adr;quoted-printable:;;Dillenburger Strasse 83;K=C3=B6ln;;51105;Deutschland
email;internet:dru...@dimedis.de
tel;work:0221 / 921260-44
tel;fax:0221 / 921260-59
x-mozilla-html:FALSE
url:http://www.dimedis.de/
version:2.1
end:vcard



[Proto-Scripty] Using the same onclick with SlideUp and SlideDown

2009-02-17 Thread craig

I'm using the SlideUp/SlideDown effects, and I'd like to use the same
button for both effects.  Context from the demo wiki:

img src=/images/uparrow.png onclick=Effect.SlideUp('%=slidedown
%'); return false;
img src=/images/downarrow.png onclick=Effect.SlideDown('
%=slidedown%'); return false;

I tried (probably stupidly because of my lack of knowledge with html
and javascript) to use a logical XOR and logical OR to sort of
conditionalize the onclick effect, but it ends up completing both
functions resulting in no change:


img src=/images/uparrow.png onclick=Effect.SlideUp('%=slidedown
%') ^ Effect.SlideDown('%=slidedown%');

or

img src=/images/uparrow.png onclick=Effect.SlideUp('%=slidedown
%') || Effect.SlideDown('%=slidedown%');

Is there a way to do this without getting too complicated with
javascript.  Or, even a way to make a conditional like %if
Effect.SlideUp('%=slidedown%') == true; Effect.SlideUp('%=slidedown
%') ; else Effect.SlideDown('%=slidedown%')%

--~--~-~--~~~---~--~~
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] Prototype changes between 1.6.0 and 1.6.0.3

2009-02-17 Thread claus.k...@googlemail.com

Hello everyone,

probably a newbie question, but here we go:

We have been using prototype for some time now, now we want to use a
few script.aculo.us features which means updating prototype.js to
1.6.0.3.
Which itself means someone - me - has to check for possible
compatibility issues between the versions.

Now, I am looking for a changes.log for version 1.6.0.3, but the
latest I can find is:

http://dev.rubyonrails.org/browser/spinoffs/prototype/tags/rel_1-6-0-2/CHANGELOG

How can I find out whether there have been API changes between 1.6.0
and 1.6.0.3?

Best regards,

Claus


--~--~-~--~~~---~--~~
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: Odd behaviour with chained calls.

2009-02-17 Thread Richard Quadling

2009/2/16 Daniel Rubin dru...@dimedis.de:
 Richard Quadling wrote:
 Hi.

 I want to set an error message for 20 seconds ...

 $('sessionError').update(o_E.responseText).show().hide.delay(20);

 The message is displayed correctly.

 But not hidden again after 20 seconds or so.
 It's because you lose the scope of the $('sessionError') Element when
 you get the hide-method.  You're back in the calling scope, which
 doesn't seem to be an Element, so that's why there's no style-property.
 This works:
   $('sessionError').update(o_E.responseText).show()
 .hide.bind($('sessionError')).delay(20);
 But the chaining doesn't really make sense any more.

 I think it could best be solved like this:
   $('sessionError').update(o_E.responseText).show();
   (function () { $('sessionError').hide (); }).delay (20:

 Have fun
 Daniel



 --
 Daniel Rubin  dru...@dimedis.de
 dimedis GmbH  www.dimedis.de
 Dillenburger Strasse 83   0221/921260-44 (-59,Fax)
 51105 Koeln   Software Entwicklung
 HRB Köln 51787Geschäftsführer: Dipl.-Ing. W. Halling

 


I'm getting it. Slowly. Very very slowly.

Thank you.


-- 
-
Richard Quadling
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498r=213474731
Standing on the shoulders of some very clever giants!

--~--~-~--~~~---~--~~
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] Calling function passed as parameter

2009-02-17 Thread marioosh

I have a problem with calling function passed as parameter in class
definition. I get error when i call fun(). How can i correct this ?

var Slider = Class.create({
initialize: function (elContainer) {
this.elContainer = elContainer;
if($(this.elContainer).getStyle('left') == '0px') {
this.minimize(this.doit);
} else {
this.doit();
}
},

minimize: function(fun) {
new Effect.Morph(this.elContainer, {
style: 'left: 940px;',
duration: 0.3,
afterFinish: function() {
$(this.elContainer).setStyle({
left: '-940px'
});
if(fun != null) {
fun(); --- ! ERROR !!
}
}.bind(this)
});
},

maximize: function() {
$(this.elContainer).show();
new Effect.Morph(this.elContainer, {
  style: 'left: 0px;',
  duration: 0.5
});
},

doit: function () {
}


});

(i pasted in: http://pastie.org/391563  to view better)


By the way - this works fine:

function foo(){
alert('foo');
}
function bar(fn){
if(fn != null) {
fn();
} else {
alert('bar');
}
}
bar(foo); // alerts 'foo'
bar();  // alerts 'bar'

--~--~-~--~~~---~--~~
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: Ajax.Autocompleter

2009-02-17 Thread david

Hi craig,

not seems trivial, could we have an example?

--
david

On 17 fév, 11:03, Craig cr...@europe.com wrote:
 Am having one problem i cannot seem to solve. The autocompleter box
 displays the results which has a set height so a scroll bar displays.
 In FF but not other browsers when you scroll through the results it
 works fine but in any other browser it will just lose focus and
 disappear.

 Anyone come accross the same problem have a fix? Am using the latest
 versions.
--~--~-~--~~~---~--~~
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: Calling function passed as parameter

2009-02-17 Thread T.J. Crowder

Hi,

What's the error?
--
T.J. Crowder
tj / crowder software / com
Independent Software Engineer, consulting services available


On Feb 17, 10:53 am, marioosh marioosh@gmail.com wrote:
 I have a problem with calling function passed as parameter in class
 definition. I get error when i call fun(). How can i correct this ?

 var Slider = Class.create({
         initialize: function (elContainer) {
                 this.elContainer = elContainer;
                 if($(this.elContainer).getStyle('left') == '0px') {
                         this.minimize(this.doit);
                 } else {
                         this.doit();
                 }
         },

         minimize: function(fun) {
                 new Effect.Morph(this.elContainer, {
                         style: 'left: 940px;',
                         duration: 0.3,
                         afterFinish: function() {
                                 $(this.elContainer).setStyle({
                                         left: '-940px'
                                 });
                                 if(fun != null) {
                                         fun(); --- ! ERROR !!
                                 }
                         }.bind(this)
                 });
         },

         maximize: function() {
                 $(this.elContainer).show();
                 new Effect.Morph(this.elContainer, {
                   style: 'left: 0px;',
                   duration: 0.5
                 });
         },

         doit: function () {
         }

 });

 (i pasted in:http://pastie.org/391563 to view better)

 By the way - this works fine:

 function foo(){
         alert('foo');}

 function bar(fn){
         if(fn != null) {
                 fn();
         } else {
                 alert('bar');
         }}

 bar(foo); // alerts 'foo'
 bar();  // alerts 'bar'
--~--~-~--~~~---~--~~
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: Multiple droppables in overflowed div!

2009-02-17 Thread david

Hi javamaasai,

try this portion of code to create droppable (instead of the FOR
loop):

$R(1,4).each(function(i){
Droppables.add('droppable_demo'+i, {
accept: 'draggable',
hoverclass: 'hover',
onDrop: function(){
alert(i);
$('droppable_demo'+i).highlight();
}
});
});

At this moment, you will see that there is not only the droppable 1
that accept drops; but droppable 1  2 !
This an an evolution ??

But for the other problem you could still not drop on droppable 3 
4 !!

I didn't really know what it is, but you could see at the function
cumulativeScrollOffset().
I think it's because the droppable don't know that the element have
scrolled and always take first element??

btw, to drop on a scrollable zone is, to my opinion, not a good
practice ! But you should have a good reason !

--
david

On 16 fév, 15:09, javamaasai ikhag...@gmail.com wrote:
 Hey All,

 I'm creating a small online traditional Shop, where tourists can buy
 African traditional goods. These include things like beads, Warrior
 spears clothing e.t.c My web application has pictures of african items
 draggables in an overflowed div and droppables pictures of visit
 locations where one.

 Issue is when multiple droppables are put in overflowed div and
 scrolled, they kind of virtually remain fixed, i.e. droppable3 scrolls
 to position of droppable1 but on dropping on droppable3 the active
 drop area is for droppable1!

 Here is small sample code test code:

 !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Strict//EN 
 http://www.w3.org/TR/xhtml1/DTD/...;
 html xmlns=http://www.w3.org/1999/xhtml;
     head
         script src=javascript/prototype.js type=text/javascript
         script src=javascript/scriptaculous.js type=text/
 javascript
         /script
     /head
     body
         style type=text/css

             div#droppable_container {
                 margin-bottom: 30px;
                 height: 300px;
                 width: 500px;
                 background: black;
                 padding: 10px;
             }

             div#droppable_demo {
                 width: 160px;
                 height: 120px;
                 font-size: 15px;
                 background: #ff;
                 border: 5px solid #ccc;
                 text-align: center;
                 float: right;
             }

                         .droppable_demo {
                 width: 100px;
                 height: 100px;
                 font-size: 15px;
                 background: #ff;
                 border: 5px solid #ccc;
                 text-align: center;
                 float: left;
                 margin: 5px;
             }

             #draggable_demo {
                 background: yellowgreen;
                 margin: 5px;
                 border: 3px solid green;
                 width: 100px;
                 height: 100px;
                 cursor: move;
                 font-size: 15px;
                 float: left;
             }

             .spaceHolder {
                 background: orange;
                 margin: 5px;
                 border: 3px solid orangered;
                 width: 100px;
                 height: 100px;
                 font-size: 15px;
                 float: left;
             }

             div#droppable_demo.hover {
                 border: 5px dashed orange;
                 background: #efefef;
             }
                         .droppable_demo.hover {
                 border: 5px dashed orange;
                 background: #efefef;
             }

             #dragContainer {
                 background: yellow;
                 border: 5px solid blue;
                 float: left;
                 width: 60%;
                 height: 120px;
                 overflow: auto; /*This is where the weirdness
 happens*/
             }
                         #dropContainer {
                 background: blue;
                 border: 5px solid red;
                 float: left;
                 width: 60%;
                 height: 120px;
                 overflow: auto; /*This is where the weirdness
 happens*/
             }

             h3 {
                 color: black;
                 float: left;
             }
         /style
         div id=droppable_container
             div id=dragContainer
                 div class=draggable id=draggable_demo
                     DRAG ME!!!
                 /div
                 !-- space holders added to create overflow --
                 div class=spaceHolder
                     Space Holder
                 /div
                 div class=spaceHolder
                     Space Holder
                 /div
                 div class=spaceHolder
                     Space Holder
                 /div
             /div
             div id=dropContainer
                 div class=droppable_demo id=droppable_demo1
             

[Proto-Scripty] Re: TypeError: Value undefined (result of expression Element.insert) is not object.

2009-02-17 Thread david

Hi Robert,

That's another problem, if prototype is loaded dynamically, it's a
kind of lazyloading you need.
just look at some code that aleready exist:
== http://ajaxian.com/archives/a-technique-for-lazy-script-loading
== http://www.bram.us/projects/js_bramus/lazierload/

Both use prototype, but the important thing is how to handle callback,
which is not prototype dependant.

--
david


On 17 fév, 01:43, chienr chi...@gmail.com wrote:
 Hi david, I don't have an example to show you, and it happens so
 randomly. FWIW, I'm loading prototype on-demand with
 element.appendChild(), which probably complicates things a little.

 I just found reference to setInterval() in Javascript, will look into
 that to see if it fits my needs.

 Thanks.

 On Feb 16, 3:50 pm, david david.brill...@gmail.com wrote:

  Hi robert,

  It's hard to guess your problem, but, javascript are loaded
  synchronously, so that not the reason.
  If you have an exemple, I could help you? a little bit more !?

  --
  david

  On 16 fév, 23:31, chienr chi...@gmail.com wrote:

   Hi,

   Intermittently, I get a browser popup error that says:

   
   RJS error:

   TypeError: Value undefined (result of expression Element.insert) is
   not object.
   

   My suspicion is that since included javascripts are loaded
   asynchronously, sometimes prototype.js doesn't finish loading before
   the page.insert_html is called. Does it sound right? If so, I suppose
   the solution involves testing whether Element.insert is defined, and
   if not, wait a little while and test again. What's the best way to do
   this as there's no sleep() in javascript?

   Any assistance is appreciated.

   Thanks,
   Robert
--~--~-~--~~~---~--~~
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: Prototype changes between 1.6.0 and 1.6.0.3

2009-02-17 Thread david

Hi Claus,

just go at : 
http://www.prototypejs.org/2008/9/30/prototype-1-6-0-3-one-more-bugfix-release-before-1-6-1#comment-22052

the changelog is inside comments !

--
david

On 17 fév, 11:44, claus.k...@googlemail.com
claus.k...@googlemail.com wrote:
 Hello everyone,

 probably a newbie question, but here we go:

 We have been using prototype for some time now, now we want to use a
 few script.aculo.us features which means updating prototype.js to
 1.6.0.3.
 Which itself means someone - me - has to check for possible
 compatibility issues between the versions.

 Now, I am looking for a changes.log for version 1.6.0.3, but the
 latest I can find is:

 http://dev.rubyonrails.org/browser/spinoffs/prototype/tags/rel_1-6-0-...

 How can I find out whether there have been API changes between 1.6.0
 and 1.6.0.3?

 Best regards,

 Claus
--~--~-~--~~~---~--~~
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: Calling function passed as parameter

2009-02-17 Thread david

Hi marioosh,

I did a test, and there is no error !!
just at :  --- ! ERROR !!


--
david

On 17 fév, 12:14, T.J. Crowder t...@crowdersoftware.com wrote:
 Hi,

 What's the error?
 --
 T.J. Crowder
 tj / crowder software / com
 Independent Software Engineer, consulting services available

 On Feb 17, 10:53 am, marioosh marioosh@gmail.com wrote:

  I have a problem with calling function passed as parameter in class
  definition. I get error when i call fun(). How can i correct this ?

  var Slider = Class.create({
          initialize: function (elContainer) {
                  this.elContainer = elContainer;
                  if($(this.elContainer).getStyle('left') == '0px') {
                          this.minimize(this.doit);
                  } else {
                          this.doit();
                  }
          },

          minimize: function(fun) {
                  new Effect.Morph(this.elContainer, {
                          style: 'left: 940px;',
                          duration: 0.3,
                          afterFinish: function() {
                                  $(this.elContainer).setStyle({
                                          left: '-940px'
                                  });
                                  if(fun != null) {
                                          fun(); --- ! ERROR 
  !!
                                  }
                          }.bind(this)
                  });
          },

          maximize: function() {
                  $(this.elContainer).show();
                  new Effect.Morph(this.elContainer, {
                    style: 'left: 0px;',
                    duration: 0.5
                  });
          },

          doit: function () {
          }

  });

  (i pasted in:http://pastie.org/391563 to view better)

  By the way - this works fine:

  function foo(){
          alert('foo');}

  function bar(fn){
          if(fn != null) {
                  fn();
          } else {
                  alert('bar');
          }}

  bar(foo); // alerts 'foo'
  bar();  // alerts 'bar'
--~--~-~--~~~---~--~~
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: Using the same onclick with SlideUp and SlideDown

2009-02-17 Thread david

Sorry craig,

So let's resume:
You want when an element was slided down, on a button click to slide
it up, and when it's slided up, on the same button click to slide it
down !!
Am I right ??

If that what you want, to do that, just use the conveniant
Effect.Toggle, where documentation is at: sorry no link, because the
gitHub website doesn't respond ?!!?
From memories, the Effect.Toggle as three possibilities:
Blind (simulate the blind up / blind down effect)
slide (to simulate the slideUp / slideDown effect) and every thing is
bundle ...

Am I right this time ??

--
david


On 17 fév, 12:45, craig bagley.cr...@gmail.com wrote:
 I don't want to click while sliding, I want to perform the opposite
 effect of what has already been clicked.  If the div has been slid
 down, I want to be able to click on the same button to have it slide
 back up and vice versa.  It isn't an issue of getting the sliding to
 work, it already does, its just for convenience, I'd like make it as
 simple as possible.
--~--~-~--~~~---~--~~
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: Ajax.Autocompleter

2009-02-17 Thread david

Hi craig,

perhaps stupid remarks, but in FF the scrollbar is contained inb the
element, not in IE.
Couldn't it be something like that ??

Can you send the code for the autocompleter ?? (just it, with
callbacks definition ??


--
david

On 17 fév, 12:48, Craig cr...@europe.com wrote:
 Sorry cant get an example online im afraid, should behave this way for
 anyone who sets a height for the auto_complete div like so:

 div.auto_complete
 {
     position:absolute;
     width: 350px;
     max-height:200px;
     overflow: auto;
     overflow-x: hidden;
     background: #fff;
     z-index:101;
     border:1px solid #888;

 }

 When clicking on the scroll bar it loses focus and closes the div. I
 am currently trying to edit the onBlur function to check if focus is
 still on this.update (the div) so i can set it to remain open.

 On 17 Feb, 11:00, david david.brill...@gmail.com wrote:

  Hi craig,

  not seems trivial, could we have an example?

  --
  david

  On 17 fév, 11:03, Craig cr...@europe.com wrote:

   Am having one problem i cannot seem to solve. The autocompleter box
   displays the results which has a set height so a scroll bar displays.
   In FF but not other browsers when you scroll through the results it
   works fine but in any other browser it will just lose focus and
   disappear.

   Anyone come accross the same problem have a fix? Am using the latest
   versions.
--~--~-~--~~~---~--~~
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: Calling function passed as parameter

2009-02-17 Thread marioosh



On 17 Lut, 12:14, T.J. Crowder t...@crowdersoftware.com wrote:
 Hi,

 What's the error?
 --

Error: Cannot convert undefined or null to Object
Slider class is a base class and doit() method is redefined in
subclasses. I see that calling fun() works, but i get error in
redefined method doit().

Redefinition here:

var SliderCategory = Class.create(Slider, {

initialize: function($super, elContainer) {
$super(elContainer);
},

doit: function() {
new Ajax.Updater(this.elContainer,'category_add.php',{

onCreate: function () {
}.bind(this),

onComplete: function(request,result) {
}.bind(this)


});
},
...
}



Error is in prototype.js:
(cut)...

Ajax.Updater = Class.create(Ajax.Request, {
  initialize: function($super, container, url, options) {
this.container = {// - ERROR Cannot
convert undefined or null to Object
  success: (container.success || container),
  failure: (container.failure || (container.success ? null :
container))
};

options = Object.clone(options);
var onComplete = options.onComplete;
options.onComplete = (function(response, json) {
  this.updateContent(response.responseText);
  if (Object.isFunction(onComplete)) onComplete(response, json);
}).bind(this);

$super(url, options);
  },

(cut)...

I've pasted in pastie.org too for better view
--~--~-~--~~~---~--~~
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: Using the same onclick with SlideUp and SlideDown

2009-02-17 Thread Alex Mcauley

Craig..

Why not try removing the onclick and adding it to an observer 

img id=foo /

Event.observe(window,'load', function() {

$('foo').observe('click',function() {
/*
please change foloowing for a tenary oprator if needs be !!
*/
if($(this).style.display!='none') {
Effect.SlideUp(this);
} else {
Effect.SlideDown(this);
}
}


}); // wrap it


Hope this helps


- Original Message - 
From: david david.brill...@gmail.com
To: Prototype  script.aculo.us prototype-scriptaculous@googlegroups.com
Sent: Tuesday, February 17, 2009 11:24 AM
Subject: [Proto-Scripty] Re: Using the same onclick with SlideUp and 
SlideDown



Hi craig,

I think it's internally manage, so you can't click while sliding.
And when you click it's slide depending on the position of the element
you try to slide.

Just one thing to remember is that you need to encapsulate you element
in a DIV inside the DIV you try to slide.

hope that help?

--
david

On 17 fév, 11:16, craig bagley.cr...@gmail.com wrote:
 I'm using the SlideUp/SlideDown effects, and I'd like to use the same
 button for both effects. Context from the demo wiki:

 img src=/images/uparrow.png onclick=Effect.SlideUp('%=slidedown
 %'); return false;
 img src=/images/downarrow.png onclick=Effect.SlideDown('
 %=slidedown%'); return false;

 I tried (probably stupidly because of my lack of knowledge with html
 and javascript) to use a logical XOR and logical OR to sort of
 conditionalize the onclick effect, but it ends up completing both
 functions resulting in no change:

 img src=/images/uparrow.png onclick=Effect.SlideUp('%=slidedown
 %') ^ Effect.SlideDown('%=slidedown%');

 or

 img src=/images/uparrow.png onclick=Effect.SlideUp('%=slidedown
 %') || Effect.SlideDown('%=slidedown%');

 Is there a way to do this without getting too complicated with
 javascript. Or, even a way to make a conditional like %if
 Effect.SlideUp('%=slidedown%') == true; Effect.SlideUp('%=slidedown
 %') ; else Effect.SlideDown('%=slidedown%')%



--~--~-~--~~~---~--~~
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: Calling function passed as parameter

2009-02-17 Thread david

Hi craig,

I've tested the following code, and it works in FF3 !!

!DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Strict//EN http://
www.w3.org/TR/xhtml1/DTD/...
html xmlns=http://www.w3.org/1999/xhtml;
head
script src=prototype.js type=text/javascript/script
script src=scriptaculous.js type=text/javascript
/script
/head
body
div id=myId
input id=bt1 type=submit/input
input id=bt2 type=submit/input
/div

script type=text/javascript
var Slider = Class.create({
  initialize: function (elContainer) {
this.elContainer = elContainer;
if($(this.elContainer).getStyle('left') == '0px') {
  this.minimize(this.doit);
} else {
  this.doit();
}
  },

  minimize: function(fun) {
new Effect.Morph(this.elContainer, {
  style: 'left: 940px;',
  duration: 0.3,
  afterFinish: function() {
$(this.elContainer).setStyle({
  left: '-940px'
});
if(fun != null) {
  fun(); //--- ! yes, this works!, NO
errors !!
}
  }.bind(this)
});
  },

  maximize: function() {
$(this.elContainer).show();
new Effect.Morph(this.elContainer, {
  style: 'left: 0px;',
  duration: 0.5
});
  },

  doit: function () {
  }


});



// BUT IN SUBCLASSES errors:


var SliderCategory = Class.create(Slider, {

  initialize: function($super, elContainer) {
$super(elContainer);
  },

  doit: function() {
new Ajax.Updater(this.elContainer,'category_add.php',{

  onCreate: function () {
  }.bind(this),

  onComplete: function(request,result) {
  }.bind(this)


});
  }
});



Ajax.Updater = Class.create(Ajax.Request, {
  initialize: function($super, container, url, options) {
this.container = {// - ERROR Cannot
convert undefined or null to Object
  success: (container.success || container),
  failure: (container.failure || (container.success ? null :
container))
};
alert($H(this.container).inspect());

options = Object.clone(options);
var onComplete = options.onComplete;
options.onComplete = (function(response, json) {
  this.updateContent(response.responseText);
  if (Object.isFunction(onComplete)) onComplete(response, json);
}).bind(this);

$super(url, options);
  }
});

new SliderCategory('myId');
/script
/body
/html

I did not modify anything, and the alert($H(this.container).inspect
()); return: #Hash:{'success': 'myId', 'failure': 'myId'} without
no error

--
david

On 17 fév, 13:12, marioosh marioosh@gmail.com wrote:
 On 17 Lut, 12:14, T.J. Crowder t...@crowdersoftware.com wrote:

  Hi,

  What's the error?
  --

 Error: Cannot convert undefined or null to Object
 Slider class is a base class and doit() method is redefined in
 subclasses. I see that calling fun() works, but i get error in
 redefined method doit().

 Redefinition here:

 var SliderCategory = Class.create(Slider, {

         initialize: function($super, elContainer) {
                 $super(elContainer);
         },

         doit: function() {
                 new Ajax.Updater(this.elContainer,'category_add.php',{

                         onCreate: function () {
                         }.bind(this),

                         onComplete: function(request,result) {
                         }.bind(this)

                 });
         },
 ...

 }

 Error is in prototype.js:
 (cut)...

 Ajax.Updater = Class.create(Ajax.Request, {
   initialize: function($super, container, url, options) {
     this.container = {                    // - ERROR Cannot
 convert undefined or null to Object
       success: (container.success || container),
       failure: (container.failure || (container.success ? null :
 container))
     };

     options = Object.clone(options);
     var onComplete = options.onComplete;
     options.onComplete = (function(response, json) {
       this.updateContent(response.responseText);
       if (Object.isFunction(onComplete)) onComplete(response, json);
     }).bind(this);

     $super(url, options);
   },

 (cut)...

 I've pasted in pastie.org too for better view
--~--~-~--~~~---~--~~
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: Using the same onclick with SlideUp and SlideDown

2009-02-17 Thread david

Hi craig,

Go and see the url of Effect.toggle:
http://wiki.github.com/madrobby/scriptaculous/effect-toggle

--
david

On 17 fév, 13:25, Alex Mcauley webmas...@thecarmarketplace.com
wrote:
 Craig..

 Why not try removing the onclick and adding it to an observer 

 img id=foo /

 Event.observe(window,'load', function() {

         $('foo').observe('click',function() {
 /*
 please change foloowing for a tenary oprator if needs be !!
 */
         if($(this).style.display!='none') {
             Effect.SlideUp(this);
         } else {
             Effect.SlideDown(this);
     }

 }
 }); // wrap it

 Hope this helps

 - Original Message -
 From: david david.brill...@gmail.com
 To: Prototype  script.aculo.us prototype-scriptaculous@googlegroups.com
 Sent: Tuesday, February 17, 2009 11:24 AM
 Subject: [Proto-Scripty] Re: Using the same onclick with SlideUp and

 SlideDown

 Hi craig,

 I think it's internally manage, so you can't click while sliding.
 And when you click it's slide depending on the position of the element
 you try to slide.

 Just one thing to remember is that you need to encapsulate you element
 in a DIV inside the DIV you try to slide.

 hope that help?

 --
 david

 On 17 fév, 11:16, craig bagley.cr...@gmail.com wrote:
  I'm using the SlideUp/SlideDown effects, and I'd like to use the same
  button for both effects. Context from the demo wiki:

  img src=/images/uparrow.png onclick=Effect.SlideUp('%=slidedown
  %'); return false;
  img src=/images/downarrow.png onclick=Effect.SlideDown('
  %=slidedown%'); return false;

  I tried (probably stupidly because of my lack of knowledge with html
  and javascript) to use a logical XOR and logical OR to sort of
  conditionalize the onclick effect, but it ends up completing both
  functions resulting in no change:

  img src=/images/uparrow.png onclick=Effect.SlideUp('%=slidedown
  %') ^ Effect.SlideDown('%=slidedown%');

  or

  img src=/images/uparrow.png onclick=Effect.SlideUp('%=slidedown
  %') || Effect.SlideDown('%=slidedown%');

  Is there a way to do this without getting too complicated with
  javascript. Or, even a way to make a conditional like %if
  Effect.SlideUp('%=slidedown%') == true; Effect.SlideUp('%=slidedown
  %') ; else Effect.SlideDown('%=slidedown%')%
--~--~-~--~~~---~--~~
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: Ajax.Autocompleter

2009-02-17 Thread Craig

Firefox probabaly ignores clicks on the scroll bar and thus does not
lose focus. Here is the main part of the code

var auto_cust;
var auto_bran;
var auto_call;

new Event.observe(window, 'load', pageload);

function pageload() {
auto_cust = new Ajax.Autocompleter('customer', 'customer_auto',
'logform_customer.asp', {minChars:-1,frequency:0.5,afterUpdateElement:
getCustomerId});
auto_bran = new Ajax.Autocompleter('branch', 'branch_auto',
'logform_branch.asp', {minChars:-1,frequency:0.5,callback:
customerCallback,afterUpdateElement: getBranchId});
auto_call = new Ajax.Autocompleter('caller', 'caller_auto',
'logform_caller.asp', {minChars:-1,frequency:0.5,callback:
customerCallback});

new Event.observe('customer', 'focus', acust);
new Event.observe('branch', 'focus', abran);
new Event.observe('caller', 'focus', acall);
$('customer').focus();
}


function acust()
{
auto_cust.activate(); //twice because IE is clever
auto_cust.activate();
}

function abran()
{
auto_bran.activate(); //twice because IE is clever
auto_bran.activate();
}

function acall()
{
auto_call.activate(); //twice because IE is clever
auto_call.activate();
}

function getBranchId(text, li) {
$('branch_id').value = li.id;
$('caller').focus();
}

function getCustomerId(text, li) {
$('customer_id').value = li.id;
$('branch').value='';
$('branch_id').value='';
$('branch').focus();
}

function customerCallback(element, entry) {
return entry + customer= + $('customer_id').value;
}

On 17 Feb, 12:01, david david.brill...@gmail.com wrote:
 Hi craig,

 perhaps stupid remarks, but in FF the scrollbar is contained inb the
 element, not in IE.
 Couldn't it be something like that ??

 Can you send the code for the autocompleter ?? (just it, with
 callbacks definition ??

 --
 david

 On 17 fév, 12:48, Craig cr...@europe.com wrote:

  Sorry cant get an example online im afraid, should behave this way for
  anyone who sets a height for the auto_complete div like so:

  div.auto_complete
  {
      position:absolute;
      width: 350px;
      max-height:200px;
      overflow: auto;
      overflow-x: hidden;
      background: #fff;
      z-index:101;
      border:1px solid #888;

  }

  When clicking on the scroll bar it loses focus and closes the div. I
  am currently trying to edit the onBlur function to check if focus is
  still on this.update (the div) so i can set it to remain open.

  On 17 Feb, 11:00, david david.brill...@gmail.com wrote:

   Hi craig,

   not seems trivial, could we have an example?

   --
   david

   On 17 fév, 11:03, Craig cr...@europe.com wrote:

Am having one problem i cannot seem to solve. The autocompleter box
displays the results which has a set height so a scroll bar displays.
In FF but not other browsers when you scroll through the results it
works fine but in any other browser it will just lose focus and
disappear.

Anyone come accross the same problem have a fix? Am using the latest
versions.
--~--~-~--~~~---~--~~
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: Ajax.Autocompleter

2009-02-17 Thread Craig

Oh and the border goes around the div and the scroll bar on IE so
doubtful that its that.

On 17 Feb, 13:08, Craig cr...@europe.com wrote:
 Firefox probabaly ignores clicks on the scroll bar and thus does not
 lose focus. Here is the main part of the code

 var auto_cust;
 var auto_bran;
 var auto_call;

 new Event.observe(window, 'load', pageload);

 function pageload() {
     auto_cust = new Ajax.Autocompleter('customer', 'customer_auto',
 'logform_customer.asp', {minChars:-1,frequency:0.5,afterUpdateElement:
 getCustomerId});
     auto_bran = new Ajax.Autocompleter('branch', 'branch_auto',
 'logform_branch.asp', {minChars:-1,frequency:0.5,callback:
 customerCallback,afterUpdateElement: getBranchId});
     auto_call = new Ajax.Autocompleter('caller', 'caller_auto',
 'logform_caller.asp', {minChars:-1,frequency:0.5,callback:
 customerCallback});

     new Event.observe('customer', 'focus', acust);
     new Event.observe('branch', 'focus', abran);
     new Event.observe('caller', 'focus', acall);
     $('customer').focus();

 }

 function acust()
 {
     auto_cust.activate(); //twice because IE is clever
     auto_cust.activate();

 }

 function abran()
 {
     auto_bran.activate(); //twice because IE is clever
     auto_bran.activate();

 }

 function acall()
 {
     auto_call.activate(); //twice because IE is clever
     auto_call.activate();

 }

 function getBranchId(text, li) {
     $('branch_id').value = li.id;
     $('caller').focus();

 }

 function getCustomerId(text, li) {
     $('customer_id').value = li.id;
     $('branch').value='';
     $('branch_id').value='';
     $('branch').focus();

 }

 function customerCallback(element, entry) {
     return entry + customer= + $('customer_id').value;

 }

 On 17 Feb, 12:01, david david.brill...@gmail.com wrote:

  Hi craig,

  perhaps stupid remarks, but in FF the scrollbar is contained inb the
  element, not in IE.
  Couldn't it be something like that ??

  Can you send the code for the autocompleter ?? (just it, with
  callbacks definition ??

  --
  david

  On 17 fév, 12:48, Craig cr...@europe.com wrote:

   Sorry cant get an example online im afraid, should behave this way for
   anyone who sets a height for the auto_complete div like so:

   div.auto_complete
   {
       position:absolute;
       width: 350px;
       max-height:200px;
       overflow: auto;
       overflow-x: hidden;
       background: #fff;
       z-index:101;
       border:1px solid #888;

   }

   When clicking on the scroll bar it loses focus and closes the div. I
   am currently trying to edit the onBlur function to check if focus is
   still on this.update (the div) so i can set it to remain open.

   On 17 Feb, 11:00, david david.brill...@gmail.com wrote:

Hi craig,

not seems trivial, could we have an example?

--
david

On 17 fév, 11:03, Craig cr...@europe.com wrote:

 Am having one problem i cannot seem to solve. The autocompleter box
 displays the results which has a set height so a scroll bar displays.
 In FF but not other browsers when you scroll through the results it
 works fine but in any other browser it will just lose focus and
 disappear.

 Anyone come accross the same problem have a fix? Am using the latest
 versions.
--~--~-~--~~~---~--~~
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: Prototype changes between 1.6.0 and 1.6.0.3

2009-02-17 Thread claus.k...@googlemail.com

On 17 Feb., 12:28, david david.brill...@gmail.com wrote:
 Hi Claus,

 just go at 
 :http://www.prototypejs.org/2008/9/30/prototype-1-6-0-3-one-more-bugfi...

 the changelog is inside comments !

Hello David,

thanks, that is exactly what I was looking for!

--~--~-~--~~~---~--~~
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: Ajax.Autocompleter

2009-02-17 Thread Craig

Have fixed this now by changing the event observer from the element to
the update element line 90 controls.js

Event.observe(this.update, 'blur', this.onBlur.bindAsEventListener
(this));



On 17 Feb, 13:08, Craig cr...@europe.com wrote:
 Firefox probabaly ignores clicks on the scroll bar and thus does not
 lose focus. Here is the main part of the code

 var auto_cust;
 var auto_bran;
 var auto_call;

 new Event.observe(window, 'load', pageload);

 function pageload() {
     auto_cust = new Ajax.Autocompleter('customer', 'customer_auto',
 'logform_customer.asp', {minChars:-1,frequency:0.5,afterUpdateElement:
 getCustomerId});
     auto_bran = new Ajax.Autocompleter('branch', 'branch_auto',
 'logform_branch.asp', {minChars:-1,frequency:0.5,callback:
 customerCallback,afterUpdateElement: getBranchId});
     auto_call = new Ajax.Autocompleter('caller', 'caller_auto',
 'logform_caller.asp', {minChars:-1,frequency:0.5,callback:
 customerCallback});

     new Event.observe('customer', 'focus', acust);
     new Event.observe('branch', 'focus', abran);
     new Event.observe('caller', 'focus', acall);
     $('customer').focus();

 }

 function acust()
 {
     auto_cust.activate(); //twice because IE is clever
     auto_cust.activate();

 }

 function abran()
 {
     auto_bran.activate(); //twice because IE is clever
     auto_bran.activate();

 }

 function acall()
 {
     auto_call.activate(); //twice because IE is clever
     auto_call.activate();

 }

 function getBranchId(text, li) {
     $('branch_id').value = li.id;
     $('caller').focus();

 }

 function getCustomerId(text, li) {
     $('customer_id').value = li.id;
     $('branch').value='';
     $('branch_id').value='';
     $('branch').focus();

 }

 function customerCallback(element, entry) {
     return entry + customer= + $('customer_id').value;

 }

 On 17 Feb, 12:01, david david.brill...@gmail.com wrote:

  Hi craig,

  perhaps stupid remarks, but in FF the scrollbar is contained inb the
  element, not in IE.
  Couldn't it be something like that ??

  Can you send the code for the autocompleter ?? (just it, with
  callbacks definition ??

  --
  david

  On 17 fév, 12:48, Craig cr...@europe.com wrote:

   Sorry cant get an example online im afraid, should behave this way for
   anyone who sets a height for the auto_complete div like so:

   div.auto_complete
   {
       position:absolute;
       width: 350px;
       max-height:200px;
       overflow: auto;
       overflow-x: hidden;
       background: #fff;
       z-index:101;
       border:1px solid #888;

   }

   When clicking on the scroll bar it loses focus and closes the div. I
   am currently trying to edit the onBlur function to check if focus is
   still on this.update (the div) so i can set it to remain open.

   On 17 Feb, 11:00, david david.brill...@gmail.com wrote:

Hi craig,

not seems trivial, could we have an example?

--
david

On 17 fév, 11:03, Craig cr...@europe.com wrote:

 Am having one problem i cannot seem to solve. The autocompleter box
 displays the results which has a set height so a scroll bar displays.
 In FF but not other browsers when you scroll through the results it
 works fine but in any other browser it will just lose focus and
 disappear.

 Anyone come accross the same problem have a fix? Am using the latest
 versions.
--~--~-~--~~~---~--~~
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: new Elemente in ie6 didn't work

2009-02-17 Thread Eric

Hi T.J.

On Jan 19, 12:31 pm, T.J. Crowder t...@crowdersoftware.com wrote:
  On my machine, the DOM version takes at least 10 times longer than the
  HTML version.

Did you use prototype DOM (x=new Element('P',{...});...) or plain
old vanilla DOM (x=document.createElement('P');...) ?

I was thinking to revert to vanilla DOM for performances issues but I
may revert to build some HTML string if it is that fast :o)
(Isn't it what scritaculous's Builder is doing internally?)

Eric

--~--~-~--~~~---~--~~
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: Calling function passed as parameter

2009-02-17 Thread T.J. Crowder

Hi,

I'll bet this is the problem line:

   this.minimize(this.doit);

You're assuming that 'this' is somehow bound to 'doit' when you pass
the reference.  It isn't.  When you later call fun(), 'this' is not
set to what you think it is within the call.  JavaScript functions are
functions, not methods.  More here:

http://blog.niftysnippets.org/2008/03/mythical-methods.html
http://blog.niftysnippets.org/2008/04/you-must-remember-this.html
http://prototypejs.org/api/function/bind
http://www.alistapart.com/articles/getoutbindingsituations

HTH,
--
T.J. Crowder
tj / crowder software / com
Independent Software Engineer, consulting services available


On Feb 17, 1:16 pm, marioosh marioosh@gmail.com wrote:
 On 17 Lut, 13:30, david david.brill...@gmail.com wrote:

  Hi craig,

  I've tested the following code, and it works in FF3 !!

 Test this (http://pastie.org/391632) - it does not work in FF:

 !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Strict//EN 
 http://www.w3.org/TR/xhtml1/DTD/...;
 html xmlns=http://www.w3.org/1999/xhtml;
     head
        script type=text/javascript src=resources/scriptaculous-
 js-1.8.2/lib/prototype.js /script
         script type=text/javascript src=resources/scriptaculous-
 js-1.8.2/src/scriptaculous.js /script

         /script
     /head
     body
                                                 div id=myId
         input id=bt1 type=submit/input
         input id=bt2 type=submit/input
         /div

                                 script type=text/javascript

 var Slider = Class.create({
   initialize: function (elContainer) {
         this.elContainer = elContainer;
       this.minimize(this.doit);
   },

   minimize: function(fun) {
     new Effect.Morph(this.elContainer, {
       style: 'left: 940px;',
       duration: 0.3,
       afterFinish: function() {
         $(this.elContainer).setStyle({
           left: '-940px'
         });
         if(fun != null) {
           fun();
         }
       }.bind(this)
     });
   },

   doit: function () {
   }

 });

 var SliderCategory = Class.create(Slider, {

   initialize: function($super, elContainer) {
     $super(elContainer);
   },

   doit: function() {
     new Ajax.Updater(this.elContainer,'category_add.php',{

       onCreate: function () {
       }.bind(this),

       onComplete: function(request,result) {
       }.bind(this)

     });
   }

 });

 new SliderCategory('myId');
         /script
     /body
 /html
--~--~-~--~~~---~--~~
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: Ajax.Autocompleter

2009-02-17 Thread Craig

?xml version=1.0 encoding=utf-8?
!DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN http://
www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd
html xmlns=http://www.w3.org/1999/xhtml; xml:lang=en-UK lang=en-
UK
head profile=http://www.w3.org/2000/08/w3c-synd/#;
meta http-equiv=Content-Type content=text/html;
charset=iso-8859-1 /
link type=text/css href=CSS/logform.css rel=stylesheet
media=screen /
script type=text/javascript src=JS/prototype.js/script
script type=text/javascript src=JS/effects.js/script
script type=text/javascript src=JS/controls.js/script
script type=text/javascript src=JS/datepicker.js/script
script type=text/javascript src=JS/prototype-date-extensions.js/
script
script type=text/javascript src=JS/funcs.js/script
/head
body
form id=calllogform name=calllogform action=logform.asp?num=
method=postlabel class=first for=customer
id=label_customerCustomerinput id=customer name=customer
size=20 type=text value= tabindex=1 /div
class=auto_complete id=customer_auto/div/label/form
script type=text/javascript
auto_cust = new Ajax.Autocompleter('customer',
'customer_auto', 'logform_customer.asp', {minChars:-1,frequency:
0.5,afterUpdateElement: getCustomerId});

function getCustomerId(text, li) {
//$('customer_id').value = li.id;
//$('branch').value='';
//$('branch_id').value='';
//$('branch').focus();
}
/script/body
/html

Sample code there


On 17 Feb, 13:08, Craig cr...@europe.com wrote:
 Firefox probabaly ignores clicks on the scroll bar and thus does not
 lose focus. Here is the main part of the code

 var auto_cust;
 var auto_bran;
 var auto_call;

 new Event.observe(window, 'load', pageload);

 function pageload() {
     auto_cust = new Ajax.Autocompleter('customer', 'customer_auto',
 'logform_customer.asp', {minChars:-1,frequency:0.5,afterUpdateElement:
 getCustomerId});
     auto_bran = new Ajax.Autocompleter('branch', 'branch_auto',
 'logform_branch.asp', {minChars:-1,frequency:0.5,callback:
 customerCallback,afterUpdateElement: getBranchId});
     auto_call = new Ajax.Autocompleter('caller', 'caller_auto',
 'logform_caller.asp', {minChars:-1,frequency:0.5,callback:
 customerCallback});

     new Event.observe('customer', 'focus', acust);
     new Event.observe('branch', 'focus', abran);
     new Event.observe('caller', 'focus', acall);
     $('customer').focus();

 }

 function acust()
 {
     auto_cust.activate(); //twice because IE is clever
     auto_cust.activate();

 }

 function abran()
 {
     auto_bran.activate(); //twice because IE is clever
     auto_bran.activate();

 }

 function acall()
 {
     auto_call.activate(); //twice because IE is clever
     auto_call.activate();

 }

 function getBranchId(text, li) {
     $('branch_id').value = li.id;
     $('caller').focus();

 }

 function getCustomerId(text, li) {
     $('customer_id').value = li.id;
     $('branch').value='';
     $('branch_id').value='';
     $('branch').focus();

 }

 function customerCallback(element, entry) {
     return entry + customer= + $('customer_id').value;

 }

 On 17 Feb, 12:01, david david.brill...@gmail.com wrote:

  Hi craig,

  perhaps stupid remarks, but in FF the scrollbar is contained inb the
  element, not in IE.
  Couldn't it be something like that ??

  Can you send the code for the autocompleter ?? (just it, with
  callbacks definition ??

  --
  david

  On 17 fév, 12:48, Craig cr...@europe.com wrote:

   Sorry cant get an example online im afraid, should behave this way for
   anyone who sets a height for the auto_complete div like so:

   div.auto_complete
   {
       position:absolute;
       width: 350px;
       max-height:200px;
       overflow: auto;
       overflow-x: hidden;
       background: #fff;
       z-index:101;
       border:1px solid #888;

   }

   When clicking on the scroll bar it loses focus and closes the div. I
   am currently trying to edit the onBlur function to check if focus is
   still on this.update (the div) so i can set it to remain open.

   On 17 Feb, 11:00, david david.brill...@gmail.com wrote:

Hi craig,

not seems trivial, could we have an example?

--
david

On 17 fév, 11:03, Craig cr...@europe.com wrote:

 Am having one problem i cannot seem to solve. The autocompleter box
 displays the results which has a set height so a scroll bar displays.
 In FF but not other browsers when you scroll through the results it
 works fine but in any other browser it will just lose focus and
 disappear.

 Anyone come accross the same problem have a fix? Am using the latest
 versions.
--~--~-~--~~~---~--~~
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 

[Proto-Scripty] Re: Ajax.Autocompleter

2009-02-17 Thread Craig

Fixed the problem now by making changes in controls.js

Line 48 this.hasFocus= false;
add below:
this.update.hasFocus = false;

Line91 Event.observe(this.element, 'blur',
this.onBlur.bindAsEventListener(this));
add below:
Event.observe(this.update, 'mouseover',
this.onDivFocus.bindAsEventListener(this));
Event.observe(this.update, 'mouseout',
this.onDivBlur.bindAsEventListener(this));

then also edit function and add 2 new

  onBlur: function(event) {
if(this.update.hasFocus == false) {
setTimeout(this.hide.bind(this), 250);
this.hasFocus = false;
this.active = false;
}
  },

  onDivFocus: function(event) {
this.update.hasFocus = true;
  },

  onDivBlur: function(event) {
this.update.hasFocus = false;
  },

in IE7 it behaves, not tested fully yet. Gets set to true when you are
on the scroll bar so is then unable to close.

On 17 Feb, 14:41, Craig cr...@europe.com wrote:
 ?xml version=1.0 encoding=utf-8?
 !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN 
 http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd;
 html xmlns=http://www.w3.org/1999/xhtml; xml:lang=en-UK lang=en-
 UK
 head profile=http://www.w3.org/2000/08/w3c-synd/#;
 meta http-equiv=Content-Type content=text/html;
 charset=iso-8859-1 /
 link type=text/css href=CSS/logform.css rel=stylesheet
 media=screen /
 script type=text/javascript src=JS/prototype.js/script
 script type=text/javascript src=JS/effects.js/script
 script type=text/javascript src=JS/controls.js/script
 script type=text/javascript src=JS/datepicker.js/script
 script type=text/javascript src=JS/prototype-date-extensions.js/
 script
 script type=text/javascript src=JS/funcs.js/script
 /head
 body
 form id=calllogform name=calllogform action=logform.asp?num=
 method=postlabel class=first for=customer
 id=label_customerCustomerinput id=customer name=customer
 size=20 type=text value= tabindex=1 /div
 class=auto_complete id=customer_auto/div/label/form
         script type=text/javascript
             auto_cust = new Ajax.Autocompleter('customer',
 'customer_auto', 'logform_customer.asp', {minChars:-1,frequency:
 0.5,afterUpdateElement: getCustomerId});

             function getCustomerId(text, li) {
                 //$('customer_id').value = li.id;
                 //$('branch').value='';
                 //$('branch_id').value='';
                 //$('branch').focus();
             }
         /script/body
 /html

 Sample code there

 On 17 Feb, 13:08, Craig cr...@europe.com wrote:

  Firefox probabaly ignores clicks on the scroll bar and thus does not
  lose focus. Here is the main part of the code

  var auto_cust;
  var auto_bran;
  var auto_call;

  new Event.observe(window, 'load', pageload);

  function pageload() {
      auto_cust = new Ajax.Autocompleter('customer', 'customer_auto',
  'logform_customer.asp', {minChars:-1,frequency:0.5,afterUpdateElement:
  getCustomerId});
      auto_bran = new Ajax.Autocompleter('branch', 'branch_auto',
  'logform_branch.asp', {minChars:-1,frequency:0.5,callback:
  customerCallback,afterUpdateElement: getBranchId});
      auto_call = new Ajax.Autocompleter('caller', 'caller_auto',
  'logform_caller.asp', {minChars:-1,frequency:0.5,callback:
  customerCallback});

      new Event.observe('customer', 'focus', acust);
      new Event.observe('branch', 'focus', abran);
      new Event.observe('caller', 'focus', acall);
      $('customer').focus();

  }

  function acust()
  {
      auto_cust.activate(); //twice because IE is clever
      auto_cust.activate();

  }

  function abran()
  {
      auto_bran.activate(); //twice because IE is clever
      auto_bran.activate();

  }

  function acall()
  {
      auto_call.activate(); //twice because IE is clever
      auto_call.activate();

  }

  function getBranchId(text, li) {
      $('branch_id').value = li.id;
      $('caller').focus();

  }

  function getCustomerId(text, li) {
      $('customer_id').value = li.id;
      $('branch').value='';
      $('branch_id').value='';
      $('branch').focus();

  }

  function customerCallback(element, entry) {
      return entry + customer= + $('customer_id').value;

  }

  On 17 Feb, 12:01, david david.brill...@gmail.com wrote:

   Hi craig,

   perhaps stupid remarks, but in FF the scrollbar is contained inb the
   element, not in IE.
   Couldn't it be something like that ??

   Can you send the code for the autocompleter ?? (just it, with
   callbacks definition ??

   --
   david

   On 17 fév, 12:48, Craig cr...@europe.com wrote:

Sorry cant get an example online im afraid, should behave this way for
anyone who sets a height for the auto_complete div like so:

div.auto_complete
{
    position:absolute;
    width: 350px;
    max-height:200px;
    overflow: auto;
    overflow-x: hidden;
    background: #fff;
    z-index:101;
    border:1px solid #888;

}

When clicking on the scroll bar it loses focus and closes the div. I
am 

[Proto-Scripty] Problems with $('formID').serialize(true).merge({foo:'bar'}).

2009-02-17 Thread Richard Quadling

Hello.

I'm having problems using the Hash.merge() method on a Form.serialize(true).


What I want to do is ...

parameters : $('formUserAdmin').serialize(true).merge({Action :
'ClientAddUser', JSONP:'tabUA_UpdateUserIDs'});

But it isn't working because the output of the serialize method is not
a true Hash, like you would get from $H().



Using ...

parameters : $H($('formUserAdmin').serialize(true)).merge({Action :
'ClientAddUser', JSONP:'tabUA_UpdateUserIDs'});

is working as I would expect.

But I don't know if I should be doing that as I was expecting the
serialize() method to return a hash.


As always, there are 2 fixes.

1 - Correct the documentation to reflect the behaviour.
2 - Fix the code.


I think the fix is in src/dom/form.js, line 28 which currently reads ...

return options.hash ? data : Object.toQueryString(data);

and maybe should read ...

return options.hash ? $H(data) : Object.toQueryString(data);


Now, if a user is already $H() the form.serialize(true), then this
still seems to be OK.

$H($H($H($H($H($('formUserAdmin').serialize(true)).merge({Foo:'bar'}).inspect()

provides the same output as ...

$H($('formUserAdmin').serialize(true)).merge({Foo:'bar'}).inspect()

which, with the patch applied is now the same as ...

$('formUserAdmin').serialize(true).merge({Foo:'bar'}).inspect()

With this patch, the documentation now agrees with the code.


In looking at the unit tests, I think the reason this has not been
seen is in unittest.js

  function assertHashEqual(expected, actual, message) {
expected = $H(expected);
actual = $H(actual);
var expected_array = expected.toArray().sort(), actual_array =
actual.toArray().sort();
message = buildMessage(message || 'assertHashEqual', 'expected:
?, actual: ?', expected, actual);
// from now we recursively zip  compare nested arrays
function block() {
  return expected_array.length == actual_array.length 
expected_array.zip(actual_array).all(assertPairEqual);
}
this.assertBlock(message, block);
  }

Both the expected and actual are converted to $H()'d. Which means they
will match.

Only the expected should be $H()'d as it the actual should already be
$H()'d by prototype.



I hope that makes sense and is right, if not, I'll stick with $H()-ing
my serialized form.



Regards,

Richard.


-- 
-
Richard Quadling
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498r=213474731
Standing on the shoulders of some very clever giants!

--~--~-~--~~~---~--~~
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: Problems with $('formID').serialize(true).merge({foo:'bar'}).

2009-02-17 Thread T.J. Crowder

Hi Richard,

I could have sworn I opened a doc ticket on this about two weeks ago,
when someone else ran into the fact that the docs say it ...returns a
hash... (which it does, in the lower-case general sense of the word
-- all POJOs are hashes; it doesn't return a Hash).

But it looks like I never got around to it.  I'll open one (lighthouse
seems to be having issues at the minute), and fix it next week when
I'll have a chance to blast through all my open docs tickets...

If you want to file a separate enhancement request on lighthouse for
having it return a Hash, feel free.  I think, though, that it's
probably not going to be changed to do that -- it's going to get
changed in another way (array or some such) because of the issue that
serialize() doesn't maintain the order of fields or allow multiple
fields with the same name, both of which it Really Should Do. :-)

FWIW,
--
T.J. Crowder
tj / crowder software / com
Independent Software Engineer, consulting services available

On Feb 17, 3:35 pm, Richard Quadling rquadl...@googlemail.com wrote:
 Hello.

 I'm having problems using the Hash.merge() method on a Form.serialize(true).

 What I want to do is ...

 parameters : $('formUserAdmin').serialize(true).merge({Action :
 'ClientAddUser', JSONP:'tabUA_UpdateUserIDs'});

 But it isn't working because the output of the serialize method is not
 a true Hash, like you would get from $H().

 Using ...

 parameters : $H($('formUserAdmin').serialize(true)).merge({Action :
 'ClientAddUser', JSONP:'tabUA_UpdateUserIDs'});

 is working as I would expect.

 But I don't know if I should be doing that as I was expecting the
 serialize() method to return a hash.

 As always, there are 2 fixes.

 1 - Correct the documentation to reflect the behaviour.
 2 - Fix the code.

 I think the fix is in src/dom/form.js, line 28 which currently reads ...

 return options.hash ? data : Object.toQueryString(data);

 and maybe should read ...

 return options.hash ? $H(data) : Object.toQueryString(data);

 Now, if a user is already $H() the form.serialize(true), then this
 still seems to be OK.

 $H($H($H($H($H($('formUserAdmin').serialize(true)).merge({Foo:'bar'}).inspect()

 provides the same output as ...

 $H($('formUserAdmin').serialize(true)).merge({Foo:'bar'}).inspect()

 which, with the patch applied is now the same as ...

 $('formUserAdmin').serialize(true).merge({Foo:'bar'}).inspect()

 With this patch, the documentation now agrees with the code.

 In looking at the unit tests, I think the reason this has not been
 seen is in unittest.js

   function assertHashEqual(expected, actual, message) {
     expected = $H(expected);
     actual = $H(actual);
     var expected_array = expected.toArray().sort(), actual_array =
 actual.toArray().sort();
     message = buildMessage(message || 'assertHashEqual', 'expected:
 ?, actual: ?', expected, actual);
     // from now we recursively zip  compare nested arrays
     function block() {
       return expected_array.length == actual_array.length 
         expected_array.zip(actual_array).all(assertPairEqual);
     }
     this.assertBlock(message, block);
   }

 Both the expected and actual are converted to $H()'d. Which means they
 will match.

 Only the expected should be $H()'d as it the actual should already be
 $H()'d by prototype.

 I hope that makes sense and is right, if not, I'll stick with $H()-ing
 my serialized form.

 Regards,

 Richard.

 --
 -
 Richard Quadling
 Zend Certified Engineer :http://zend.com/zce.php?c=ZEND002498r=213474731
 Standing on the shoulders of some very clever giants!
--~--~-~--~~~---~--~~
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: Problems with $('formID').serialize(true).merge({foo:'bar'}).

2009-02-17 Thread T.J. Crowder

Naturally as soon as I give up and post, Lighthouse comes back to
life.
The ticket: 
http://prototype.lighthouseapp.com/projects/8886-prototype/tickets/556

-- T.J. :-)

On Feb 17, 4:20 pm, T.J. Crowder t...@crowdersoftware.com wrote:
 Hi Richard,

 I could have sworn I opened a doc ticket on this about two weeks ago,
 when someone else ran into the fact that the docs say it ...returns a
 hash... (which it does, in the lower-case general sense of the word
 -- all POJOs are hashes; it doesn't return a Hash).

 But it looks like I never got around to it.  I'll open one (lighthouse
 seems to be having issues at the minute), and fix it next week when
 I'll have a chance to blast through all my open docs tickets...

 If you want to file a separate enhancement request on lighthouse for
 having it return a Hash, feel free.  I think, though, that it's
 probably not going to be changed to do that -- it's going to get
 changed in another way (array or some such) because of the issue that
 serialize() doesn't maintain the order of fields or allow multiple
 fields with the same name, both of which it Really Should Do. :-)

 FWIW,
 --
 T.J. Crowder
 tj / crowder software / com
 Independent Software Engineer, consulting services available

 On Feb 17, 3:35 pm, Richard Quadling rquadl...@googlemail.com wrote:

  Hello.

  I'm having problems using the Hash.merge() method on a Form.serialize(true).

  What I want to do is ...

  parameters : $('formUserAdmin').serialize(true).merge({Action :
  'ClientAddUser', JSONP:'tabUA_UpdateUserIDs'});

  But it isn't working because the output of the serialize method is not
  a true Hash, like you would get from $H().

  Using ...

  parameters : $H($('formUserAdmin').serialize(true)).merge({Action :
  'ClientAddUser', JSONP:'tabUA_UpdateUserIDs'});

  is working as I would expect.

  But I don't know if I should be doing that as I was expecting the
  serialize() method to return a hash.

  As always, there are 2 fixes.

  1 - Correct the documentation to reflect the behaviour.
  2 - Fix the code.

  I think the fix is in src/dom/form.js, line 28 which currently reads ...

  return options.hash ? data : Object.toQueryString(data);

  and maybe should read ...

  return options.hash ? $H(data) : Object.toQueryString(data);

  Now, if a user is already $H() the form.serialize(true), then this
  still seems to be OK.

  $H($H($H($H($H($('formUserAdmin').serialize(true)).merge({Foo:'bar'}).inspect()

  provides the same output as ...

  $H($('formUserAdmin').serialize(true)).merge({Foo:'bar'}).inspect()

  which, with the patch applied is now the same as ...

  $('formUserAdmin').serialize(true).merge({Foo:'bar'}).inspect()

  With this patch, the documentation now agrees with the code.

  In looking at the unit tests, I think the reason this has not been
  seen is in unittest.js

    function assertHashEqual(expected, actual, message) {
      expected = $H(expected);
      actual = $H(actual);
      var expected_array = expected.toArray().sort(), actual_array =
  actual.toArray().sort();
      message = buildMessage(message || 'assertHashEqual', 'expected:
  ?, actual: ?', expected, actual);
      // from now we recursively zip  compare nested arrays
      function block() {
        return expected_array.length == actual_array.length 
          expected_array.zip(actual_array).all(assertPairEqual);
      }
      this.assertBlock(message, block);
    }

  Both the expected and actual are converted to $H()'d. Which means they
  will match.

  Only the expected should be $H()'d as it the actual should already be
  $H()'d by prototype.

  I hope that makes sense and is right, if not, I'll stick with $H()-ing
  my serialized form.

  Regards,

  Richard.

  --
  -
  Richard Quadling
  Zend Certified Engineer :http://zend.com/zce.php?c=ZEND002498r=213474731
  Standing on the shoulders of some very clever giants!


--~--~-~--~~~---~--~~
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: Calling function passed as parameter

2009-02-17 Thread david

Hi marioosh,

TJ is right, when you call the doit function via fun, the 'this' value
is equal to Object window.
So you need a little more binding to resolve your problem:

replace the call to this.minimize(this.doit);  by this.minimize
(this.doit.bind(this));

--
david

On 17 fév, 15:33, T.J. Crowder t...@crowdersoftware.com wrote:
 Hi,

 I'll bet this is the problem line:

        this.minimize(this.doit);

 You're assuming that 'this' is somehow bound to 'doit' when you pass
 the reference.  It isn't.  When you later call fun(), 'this' is not
 set to what you think it is within the call.  JavaScript functions are
 functions, not methods.  More here:

 http://blog.niftysnippets.org/2008/03/mythical-methods.htmlhttp://blog.niftysnippets.org/2008/04/you-must-remember-this.htmlhttp://prototypejs.org/api/function/bindhttp://www.alistapart.com/articles/getoutbindingsituations

 HTH,
 --
 T.J. Crowder
 tj / crowder software / com
 Independent Software Engineer, consulting services available

 On Feb 17, 1:16 pm, marioosh marioosh@gmail.com wrote:

  On 17 Lut, 13:30, david david.brill...@gmail.com wrote:

   Hi craig,

   I've tested the following code, and it works in FF3 !!

  Test this (http://pastie.org/391632) - it does not work in FF:

  !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Strict//EN 
  http://www.w3.org/TR/xhtml1/DTD/...;
  html xmlns=http://www.w3.org/1999/xhtml;
      head
         script type=text/javascript src=resources/scriptaculous-
  js-1.8.2/lib/prototype.js /script
          script type=text/javascript src=resources/scriptaculous-
  js-1.8.2/src/scriptaculous.js /script

          /script
      /head
      body
                                                  div id=myId
          input id=bt1 type=submit/input
          input id=bt2 type=submit/input
          /div

                                  script type=text/javascript

  var Slider = Class.create({
    initialize: function (elContainer) {
          this.elContainer = elContainer;
        this.minimize(this.doit);
    },

    minimize: function(fun) {
      new Effect.Morph(this.elContainer, {
        style: 'left: 940px;',
        duration: 0.3,
        afterFinish: function() {
          $(this.elContainer).setStyle({
            left: '-940px'
          });
          if(fun != null) {
            fun();
          }
        }.bind(this)
      });
    },

    doit: function () {
    }

  });

  var SliderCategory = Class.create(Slider, {

    initialize: function($super, elContainer) {
      $super(elContainer);
    },

    doit: function() {
      new Ajax.Updater(this.elContainer,'category_add.php',{

        onCreate: function () {
        }.bind(this),

        onComplete: function(request,result) {
        }.bind(this)

      });
    }

  });

  new SliderCategory('myId');
          /script
      /body
  /html
--~--~-~--~~~---~--~~
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] Droppables in overflowed div!

2009-02-17 Thread javamaasai

Dear Team,

Humble apologies for spamming, but was using the framework to create
an urgent job. forgive me! I have multiple droppables in an overflowed
div, the draggable seem to only remember the offset position of the
droppables. If i move the droppables in the overflowed div there's no
correct drop registration.

Here's My sample code!
!DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Strict//EN http://
www.w3.org/TR/xhtml1/DTD/...
html xmlns=http://www.w3.org/1999/xhtml;
head
script src=scriptaculous/prototype.js type=text/javascript
/script
script src=scriptaculous/scriptaculous.js type=text/
javascript
/script
/script
/head
body
style type=text/css

div#droppable_container {
margin-bottom: 30px;
height: 300px;
width: 500px;
background: black;
padding: 10px;
}

div#droppable_demo {
width: 160px;
height: 120px;
font-size: 15px;
background: #ff;
border: 5px solid #ccc;
text-align: center;
}

.droppable_demo {
width: 100px;
height: 100px;
font-size: 15px;
background: #ff;
border: 5px solid #ccc;
text-align: center;
float: left;
margin: 5px;
}

#draggable_demo {
background: yellowgreen;
margin: 5px;
border: 3px solid green;
width: 100px;
height: 100px;
cursor: move;
font-size: 15px;
float: left;
}

.spaceHolder {
background: orange;
margin: 5px;
border: 3px solid orangered;
width: 100px;
height: 100px;
font-size: 15px;
float: left;
}

div#droppable_demo.hover {
border: 5px dashed orange;
background: #efefef;
}

.droppable_demo.hover {
border: 5px dashed orange;
background: #efefef;
}

#dragContainer {
background: yellow;
border: 5px solid blue;
float: left;
width: 60%;
height: 120px;
overflow: auto; /*This is where the weirdness happens*/
}

#dropContainer {
background: blue;
border: 5px solid red;
float: left;
width: 60%;
height: 120px;
overflow: auto; /*This is where the weirdness happens*/
}

#setter {
background: blue;
border: 5px solid red;
width: 100px;
height: 100px;
position: absolute;
}

h3 {
color: black;
float: left;
}
/style
div id=droppable_container
div id=dragContainer
div class=draggable id=draggable_demo
DRAG ME!!!
/div
!-- space holders added to create overflow --
div class=spaceHolder
Space Holder
/div
div class=spaceHolder
Space Holder
/div
div class=spaceHolder
Space Holder
/div
/div
div id=dropContainer onScroll=add();
div id=container style=top: 0px;
div class=droppable_demo id=droppable_demo1
Drop here1!
/div
!-- space holders added to create overflow --
div class=droppable_demo id=droppable_demo2
Drop here2!
/div
div class=droppable_demo id=droppable_demo3
Drop here3!
/div
div class=droppable_demo id=droppable_demo4
Drop here4!
/div
/div
/div
h3Draggables in yellow container with blue border, droppables in
blue containter with red border. Drag green box to Drop here 1, it
will change bourder on hover. Then scroll the droppables in blue until
you can see half-botttom of Drop here 1  Drop here 2 and the last two
Drop here 3  4./h3
script type=text/javascript
new Draggable('draggable_demo', {
revert: true,
ghosting: true // this is needed to avoid the craziness of
the overflowed div's scroll bars
});
Droppables.add('dropContainer', {
accept: 'draggable',
onHover: function(){
if (!activate) {
makeDroppable();
activate = true;
testerbox.value = activate;
}
}
});

 makeDroppable();
function makeDroppable(){
for (var i = 1; i = 4; i++) {
Droppables.add('droppable_demo' + i, {
accept: 'draggable',
hoverclass: 'hover',
onDrop: function(){
$('droppable_demo' + i).highlight();
  

[Proto-Scripty] Re: Using the same onclick with SlideUp and SlideDown

2009-02-17 Thread craig

Thanks guys.  I didn't realize toggle would do this for me.
--~--~-~--~~~---~--~~
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: Calling function passed as parameter

2009-02-17 Thread marioosh

I see...yes, that works!
thanks very much!! :D

ps: sorry for my english ;)
On 17 Lut, 18:41, david david.brill...@gmail.com wrote:
 Hi marioosh,

 TJ is right, when you call the doit function via fun, the 'this' value
 is equal to Object window.
 So you need a little more binding to resolve your problem:

 replace the call to this.minimize(this.doit);  by this.minimize
 (this.doit.bind(this));

 --
 david
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---