[Proto-Scripty] Re: Using Scriptaculous for slide down effect in some dynamic JS:

2012-03-08 Thread Victor


 new Effect.SlideDown(expandEle, {duration: 3}); 

 , But to no avail


What exactly is not working? You can make example at jsbin.com - we can 
find some solution faster. 

-- 
You received this message because you are subscribed to the Google Groups 
Prototype  script.aculo.us group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/prototype-scriptaculous/-/AK8fW97j_IcJ.
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 `element.update()` on td elements

2011-12-30 Thread T.J. Crowder
Hi,

On Dec 27, 2:35 pm, Aaron J Spetner aaron.spet...@spetnik.com wrote:
 Is the `update()` method intended to work on td elements? Every time
 I try I get an 'INVALID_STATE_ERR'.

 Thanks
 AJS

Yes, Element#update works just fine on `td` elements. Example:
http://jsbin.com/aqehax

It even works when you use it to add/remove table cells, because
Prototype does some under-the-covers stuff to make that work even on
browsers which are a bit difficult about manipulating tables in that
way. (But if you do things like replacing multiple table cells in a
row with just one table cell without using `colspan`, results will
still vary across browsers -- ex http://jsbin.com/aqehax/3 -- but
that's no great surprise, and using colspan -- ex http://jsbin.com/aqehax/4
-- works.)

HTH,
--
T.J. Crowder
Independent Software Engineer
tj / crowder software / com
www / crowder software / 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] Re: Using only one draghandle in a sortable List

2011-09-23 Thread Luke
Nevermind, I refactored the code, this isnt nexxessary anymore.

-- 
You received this message because you are subscribed to the Google Groups 
Prototype  script.aculo.us group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/prototype-scriptaculous/-/Gjf9O2Fh5bYJ.
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.



Re: [Proto-Scripty] Re: Using Prototype

2010-07-07 Thread Alex McAuley

My two pennies for what it's worth.

I used to use prototype in everything and I loved it for AJAX and DOM 
manipulation. I have since moved everything I do to jQuery because it serves 
my purposes more with it's live bindings and garbage collection. I also love 
jquery's $.fn methods to easilt create functions and classes.


I write extensive User Interface applications - one of them being an open 
source web desktop (which is the reason I ported to jQuery) being that the 
code was 400 lines rather than 2000+ in prototype (probably my code but 
never the less!!)


jQuery has lovely chaining abilities making manipulation nice and straight 
forward.


Most of the stuff I miss from prototype I hack around or just make do 
without.


I am not in anyway saying one is better than the other for overall general 
usage - I just find jQuery alot faster to develop with.


Alex Mcauley
http://www.thevacancymarket.com



- Original Message - 
From: joe t. thooke...@gmail.com

To: Prototype  script.aculo.us prototype-scriptaculous@googlegroups.com
Sent: Wednesday, July 07, 2010 2:31 AM
Subject: [Proto-Scripty] Re: Using Prototype


Expanding somewhat on T.J.'s point, i definitely couldn't work without
Prototype's data management utilities (Enumerable, Object extensions,
etc).

i love jQuery's compactness and efficiency, but with almost no
attention to Javascript data, i'd rather sacrifice it's DOM efficiency
to have Prototype's data/object manipulation skills.

For lightweight websites that don't require a lot of local data
treatment, i'll use jQuery because it's fairly easy to get used to,
and compact. For anything where i'm retrieving server data or managing
data within the client for an app, i stick to Prototype, and i've
rarely had occasion for them to overlap.

Just my thoughts. It's not a blog, i know, but since you asked... :)
joe t.


On Jul 6, 12:39 am, P.J. pjfontil...@gmail.com wrote:

Thanks T.J. The Language section is definitely a prime example of an
area Prototype excels at where jQuery does little in. My aim is to use
both libraries in a manner that complements each other. Just looking
for positive reinforcement in that idea; looking for specific
strengths each library has.

On Jul 5, 2:15 am, T.J. Crowder t...@crowdersoftware.com wrote:

 Hi,

 Just generally speaking, but: If you go to the API reference[1], most
 things in the Language section fall into the category of things
 Prototype provides that jQuery doesn't. jQuery has $.each, but most of
 the other stuff in Prototype's Enumerable isn't in jQuery.

 I _think_ Prototype 1.7 (currently at RC2) has better support for
 querying the layout of elements than jQuery does -- for instance,
 finding out the current pixel value of an auto margin.

 [1]http://api.prototypejs.org/

 FWIW,
 --
 T.J. Crowder
 Independent Software Consultant
 tj / crowder software / comwww.crowdersoftware.com

 On Jul 4, 6:24 pm, P.J. pjfontil...@gmail.com wrote:

  Hi guys,

  First off, here's a reference I'd like you to read so you'll
  understand where I'm coming from.http://jqueryvsmootools.com/

  It's written by Aaron Newton and it's about jQuery and MooTools. Short
  and sweet, jQuery focuses on the DOM, and does a pretty good job with
  it; and MooTools focuses on the entire JavaScript language.

  Aaron's MooTools is my Prototype. I have a library that uses both
  jQuery and Prototype. I'm not using Scriptaculous as jQuery can handle
  most of the UI. I've been using Prototype to parse JSON and retrieve
  data from external sources, and always consider using it first when I
  come across something difficult to code. I have both in my library
  because I wanted to be able to use widgets for both, thus netting me a
  large variety of widgets and functionality from both camps.

  Should I be treating Prototype similar to how Aaron views MooTools? As
  an extension of the entire JavaScript language as a whole?

  Does anyone have any examples of situations where Prototype provides
  functionality that jQuery doesn't? Mainly, anything outside the UI.
  jQuery also supports JSON usage, but by using Prototype I can not only
  parse JSON but XML and other arbitrary data types as well. I wish to
  re-evaluate my decision to use both in one library, especially if one
  of my reasons was the usage of plugins from both camps and the other
  was that Prototype and jQuery serve different purposes.

  Please help me out, I always attempt to contribute my findings back to
  the community and would greatly appreciate it.




--
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-scriptacul...@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.



--
You received this message because you are subscribed

[Proto-Scripty] Re: Using Prototype

2010-07-06 Thread joe t.
Expanding somewhat on T.J.'s point, i definitely couldn't work without
Prototype's data management utilities (Enumerable, Object extensions,
etc).

i love jQuery's compactness and efficiency, but with almost no
attention to Javascript data, i'd rather sacrifice it's DOM efficiency
to have Prototype's data/object manipulation skills.

For lightweight websites that don't require a lot of local data
treatment, i'll use jQuery because it's fairly easy to get used to,
and compact. For anything where i'm retrieving server data or managing
data within the client for an app, i stick to Prototype, and i've
rarely had occasion for them to overlap.

Just my thoughts. It's not a blog, i know, but since you asked... :)
joe t.


On Jul 6, 12:39 am, P.J. pjfontil...@gmail.com wrote:
 Thanks T.J. The Language section is definitely a prime example of an
 area Prototype excels at where jQuery does little in. My aim is to use
 both libraries in a manner that complements each other. Just looking
 for positive reinforcement in that idea; looking for specific
 strengths each library has.

 On Jul 5, 2:15 am, T.J. Crowder t...@crowdersoftware.com wrote:

  Hi,

  Just generally speaking, but: If you go to the API reference[1], most
  things in the Language section fall into the category of things
  Prototype provides that jQuery doesn't. jQuery has $.each, but most of
  the other stuff in Prototype's Enumerable isn't in jQuery.

  I _think_ Prototype 1.7 (currently at RC2) has better support for
  querying the layout of elements than jQuery does -- for instance,
  finding out the current pixel value of an auto margin.

  [1]http://api.prototypejs.org/

  FWIW,
  --
  T.J. Crowder
  Independent Software Consultant
  tj / crowder software / comwww.crowdersoftware.com

  On Jul 4, 6:24 pm, P.J. pjfontil...@gmail.com wrote:

   Hi guys,

   First off, here's a reference I'd like you to read so you'll
   understand where I'm coming from.http://jqueryvsmootools.com/

   It's written by Aaron Newton and it's about jQuery and MooTools. Short
   and sweet, jQuery focuses on the DOM, and does a pretty good job with
   it; and MooTools focuses on the entire JavaScript language.

   Aaron's MooTools is my Prototype. I have a library that uses both
   jQuery and Prototype. I'm not using Scriptaculous as jQuery can handle
   most of the UI. I've been using Prototype to parse JSON and retrieve
   data from external sources, and always consider using it first when I
   come across something difficult to code. I have both in my library
   because I wanted to be able to use widgets for both, thus netting me a
   large variety of widgets and functionality from both camps.

   Should I be treating Prototype similar to how Aaron views MooTools? As
   an extension of the entire JavaScript language as a whole?

   Does anyone have any examples of situations where Prototype provides
   functionality that jQuery doesn't? Mainly, anything outside the UI.
   jQuery also supports JSON usage, but by using Prototype I can not only
   parse JSON but XML and other arbitrary data types as well. I wish to
   re-evaluate my decision to use both in one library, especially if one
   of my reasons was the usage of plugins from both camps and the other
   was that Prototype and jQuery serve different purposes.

   Please help me out, I always attempt to contribute my findings back to
   the community and would greatly appreciate it.



-- 
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-scriptacul...@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 Prototype

2010-07-05 Thread T.J. Crowder
Hi,

Just generally speaking, but: If you go to the API reference[1], most
things in the Language section fall into the category of things
Prototype provides that jQuery doesn't. jQuery has $.each, but most of
the other stuff in Prototype's Enumerable isn't in jQuery.

I _think_ Prototype 1.7 (currently at RC2) has better support for
querying the layout of elements than jQuery does -- for instance,
finding out the current pixel value of an auto margin.

[1] http://api.prototypejs.org/

FWIW,
--
T.J. Crowder
Independent Software Consultant
tj / crowder software / com
www.crowdersoftware.com

On Jul 4, 6:24 pm, P.J. pjfontil...@gmail.com wrote:
 Hi guys,

 First off, here's a reference I'd like you to read so you'll
 understand where I'm coming from.http://jqueryvsmootools.com/

 It's written by Aaron Newton and it's about jQuery and MooTools. Short
 and sweet, jQuery focuses on the DOM, and does a pretty good job with
 it; and MooTools focuses on the entire JavaScript language.

 Aaron's MooTools is my Prototype. I have a library that uses both
 jQuery and Prototype. I'm not using Scriptaculous as jQuery can handle
 most of the UI. I've been using Prototype to parse JSON and retrieve
 data from external sources, and always consider using it first when I
 come across something difficult to code. I have both in my library
 because I wanted to be able to use widgets for both, thus netting me a
 large variety of widgets and functionality from both camps.

 Should I be treating Prototype similar to how Aaron views MooTools? As
 an extension of the entire JavaScript language as a whole?

 Does anyone have any examples of situations where Prototype provides
 functionality that jQuery doesn't? Mainly, anything outside the UI.
 jQuery also supports JSON usage, but by using Prototype I can not only
 parse JSON but XML and other arbitrary data types as well. I wish to
 re-evaluate my decision to use both in one library, especially if one
 of my reasons was the usage of plugins from both camps and the other
 was that Prototype and jQuery serve different purposes.

 Please help me out, I always attempt to contribute my findings back to
 the community and would greatly appreciate it.

-- 
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-scriptacul...@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 Prototype

2010-07-05 Thread P.J.
Thanks T.J. The Language section is definitely a prime example of an
area Prototype excels at where jQuery does little in. My aim is to use
both libraries in a manner that complements each other. Just looking
for positive reinforcement in that idea; looking for specific
strengths each library has.

On Jul 5, 2:15 am, T.J. Crowder t...@crowdersoftware.com wrote:
 Hi,

 Just generally speaking, but: If you go to the API reference[1], most
 things in the Language section fall into the category of things
 Prototype provides that jQuery doesn't. jQuery has $.each, but most of
 the other stuff in Prototype's Enumerable isn't in jQuery.

 I _think_ Prototype 1.7 (currently at RC2) has better support for
 querying the layout of elements than jQuery does -- for instance,
 finding out the current pixel value of an auto margin.

 [1]http://api.prototypejs.org/

 FWIW,
 --
 T.J. Crowder
 Independent Software Consultant
 tj / crowder software / comwww.crowdersoftware.com

 On Jul 4, 6:24 pm, P.J. pjfontil...@gmail.com wrote:



  Hi guys,

  First off, here's a reference I'd like you to read so you'll
  understand where I'm coming from.http://jqueryvsmootools.com/

  It's written by Aaron Newton and it's about jQuery and MooTools. Short
  and sweet, jQuery focuses on the DOM, and does a pretty good job with
  it; and MooTools focuses on the entire JavaScript language.

  Aaron's MooTools is my Prototype. I have a library that uses both
  jQuery and Prototype. I'm not using Scriptaculous as jQuery can handle
  most of the UI. I've been using Prototype to parse JSON and retrieve
  data from external sources, and always consider using it first when I
  come across something difficult to code. I have both in my library
  because I wanted to be able to use widgets for both, thus netting me a
  large variety of widgets and functionality from both camps.

  Should I be treating Prototype similar to how Aaron views MooTools? As
  an extension of the entire JavaScript language as a whole?

  Does anyone have any examples of situations where Prototype provides
  functionality that jQuery doesn't? Mainly, anything outside the UI.
  jQuery also supports JSON usage, but by using Prototype I can not only
  parse JSON but XML and other arbitrary data types as well. I wish to
  re-evaluate my decision to use both in one library, especially if one
  of my reasons was the usage of plugins from both camps and the other
  was that Prototype and jQuery serve different purposes.

  Please help me out, I always attempt to contribute my findings back to
  the community and would greatly appreciate it.

-- 
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-scriptacul...@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 store with options and IE7

2010-05-31 Thread blechler
Beauty!  Thanks man!

On May 29, 2:52 am, T.J. Crowder t...@crowdersoftware.com wrote:
 Hi,

 The `Option` constructor is provided by the browser and returns an
 HTMLOptionElement instance; since IE6 and IE7 don't allow prototypical
 extensions to these things[1], you have to run it through `$` (or
 `Element.extend`) to extend the element:

 function optionAdder(s) {
   var optIdx = $('mySelect').options.length;
   $('mySelect').options[optIdx] = $(new Option(s.text, s.val)); // ==
 Change is here
   $('mySelect').options[optIdx].store(meta, s.meta);

 }

 In contrast to `Option`, the `Element` constructor is provided by
 Prototype and does this for you automatically.

 [1]http://prototypejs.org/learn/extensions

 HTH,
 --
 T.J. Crowder
 Independent Software Consultant
 tj / crowder software / comwww.crowdersoftware.com

 On May 28, 4:30 pm, blechler lech...@gmail.com wrote:


-- 
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-scriptacul...@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 with statement

2010-05-04 Thread T.J. Crowder
Hi,

 my question is simple : isn't there a way do define the class member
 functions in such a way
 that the scope (this) will refer to the object instance ?

`this` is never scope in Javascript (unless you use `with`, which
simulates scope to an extent). It's just an object reference. If you
want to refer to a property on the instance, you have to be explicit
(either by typing this. or using with).

So the answer to your question is no, there's no reasonable way (that
I know of) to define a member function such that unqualified symbols
resolve to properties on `this`, other than to wrap the code of every
member function inside a `with` statement, which I wouldn't recommend
for several reasons. (I say reasonable because it's probably
possible using `eval` and functions generated on the fly.)

Your best bet, in my book, is to simply use `this.` when referring to
a property on `this`. I think it's clearer anyway (in fact, I always
use `this.` in Java and C#, even though the compiler doesn't need me
to -- in my view, *I* need me to, as do any code maintainers coming
after me.) If the length bothers you, you can put `var t = this;` at
the top of every function and use `t.` instead of `this.`. (Doing that
also has the advantage that the meaning to `t.` will survive
transition into closures, whereas `this.` will not.)

HTH,
--
T.J. Crowder
Independent Software Consultant
tj / crowder software / com
www.crowdersoftware.com

On Apr 30, 1:30 pm, Ran Berenfeld berenfeld...@gmail.com wrote:
 Thanks a lot for your reply T.J
 I was partially familiar with this mechanism, and now I know more :)
 anyway, let me re-phrase my question
 we all know that an event received on a DOM element (i.e button onclick
 event for example)
 will have the this equals to the DOM element

 my question is simple : isn't there a way do define the class member
 functions in such a way
 that the scope (this) will refer to the object instance ?

 Thanks
 Ran B

 On Fri, Apr 30, 2010 at 9:31 AM, T.J. Crowder t...@crowdersoftware.comwrote:





  Hi,

   is there a way that I can get rid of all these usages of this

  No. `this` is different in Javascript than in some other languages
  with the same keyword, in several ways. One of these is that
  unqualified references like your _div (without anything in front of
  it) are not automatically resolved against property names on `this`;
  all identifier resolution in Javascript is lexically-based, using the
  concept of a scope chain (more below if you're interested). So you
  have to explicitly type `this.` when accessing the properties on
  `this` (just as you have to type `foo.` to access the properties on
  `foo`), or as you've found, you can use `with`. Be aware that using
  `with` has some gotchas that are not obvious. Douglas Crockford
  lists many of these in his with Statement Considered Harmful[1]
  article (I'm not a fan of Considered Harmful articles[2], but
  Crockford lays out the issues fairly well). My point isn't don't use
  it, it's be sure you understand the gotchas when using it.

  About the scope chain and identifier resolution: One of the things I
  love about Javascript is that basically *everything* is an object,
  even if some of the objects are hidden behind the scenes. One of these
  behind-the-scenes objects is the variable object (the binding
  object of the variable environment in the latest spec -- yikes). When
  you declare a variable using `var`, you're adding a *property* to the
  variable object for the current scope. The variable object has
  properties for all `var`s, all functions declared in the scope, and
  (if the scope relates to a function) all named arguments to the
  function. When the step-by-step code within the scope is executing,
  that scope's variable object is at the beginning of the scope chain.
  All unqualified references are first checked against that variable
  object to see if they match a property on it. If they do, that
  property is used; if not, the next variable object in the chain is
  checked; etc.

  Example:

  var x = 1;

  function foo() {
     var y = 2;

     function bar() {
         var z = 3;

         alert(x);
         alert(y);
         alert(z);
     }
  }

  We have three scopes there: Global scope, `foo`'s scope, and `bar`'s
  scope. Consequently, we have three variable objects. When code within
  `bar` is being executed, the scope chain consists of `bar`'s variable
  object, followed by `foo`'s, followed by the global variable object.
  When `bar` references `z`, the `z` property is found on the first
  variable object and used. When `bar` references `y`, it's not on the
  first variable object but it is on the second one, so it's used from
  there. Accessing `x` involves going back two variable objects to the
  global one.

  As you can see, `this` doesn't come into it -- it's nowhere on the
  scope chain unless you insert it, which is exactly what `with` does:
  Puts the object you specify at the beginning of the 

[Proto-Scripty] Re: using with statement

2010-04-30 Thread T.J. Crowder
Hi,

 is there a way that I can get rid of all these usages of this

No. `this` is different in Javascript than in some other languages
with the same keyword, in several ways. One of these is that
unqualified references like your _div (without anything in front of
it) are not automatically resolved against property names on `this`;
all identifier resolution in Javascript is lexically-based, using the
concept of a scope chain (more below if you're interested). So you
have to explicitly type `this.` when accessing the properties on
`this` (just as you have to type `foo.` to access the properties on
`foo`), or as you've found, you can use `with`. Be aware that using
`with` has some gotchas that are not obvious. Douglas Crockford
lists many of these in his with Statement Considered Harmful[1]
article (I'm not a fan of Considered Harmful articles[2], but
Crockford lays out the issues fairly well). My point isn't don't use
it, it's be sure you understand the gotchas when using it.

About the scope chain and identifier resolution: One of the things I
love about Javascript is that basically *everything* is an object,
even if some of the objects are hidden behind the scenes. One of these
behind-the-scenes objects is the variable object (the binding
object of the variable environment in the latest spec -- yikes). When
you declare a variable using `var`, you're adding a *property* to the
variable object for the current scope. The variable object has
properties for all `var`s, all functions declared in the scope, and
(if the scope relates to a function) all named arguments to the
function. When the step-by-step code within the scope is executing,
that scope's variable object is at the beginning of the scope chain.
All unqualified references are first checked against that variable
object to see if they match a property on it. If they do, that
property is used; if not, the next variable object in the chain is
checked; etc.

Example:

var x = 1;

function foo() {
var y = 2;

function bar() {
var z = 3;

alert(x);
alert(y);
alert(z);
}
}

We have three scopes there: Global scope, `foo`'s scope, and `bar`'s
scope. Consequently, we have three variable objects. When code within
`bar` is being executed, the scope chain consists of `bar`'s variable
object, followed by `foo`'s, followed by the global variable object.
When `bar` references `z`, the `z` property is found on the first
variable object and used. When `bar` references `y`, it's not on the
first variable object but it is on the second one, so it's used from
there. Accessing `x` involves going back two variable objects to the
global one.

As you can see, `this` doesn't come into it -- it's nowhere on the
scope chain unless you insert it, which is exactly what `with` does:
Puts the object you specify at the beginning of the scope chain.

Now, I called the variable object a behind-the-scenes object. That's
usually true, but there's an exception: The variable object for the
global scope is the global object, which on browsers is `window` (more
accurately, on browsers the global object has a property, `window`, it
points to itself with). That's why when you declare variables and
functions at global scope, they magically show up as properties on
`window`.

[1] http://yuiblog.com/blog/2006/04/11/with-statement-considered-harmful/
[2] http://meyerweb.com/eric/comment/chech.html

HTH,
--
T.J. Crowder
Independent Software Consultant
tj / crowder software / com
www.crowdersoftware.com

On Apr 29, 9:17 am, Ran Berenfeld berenfeld...@gmail.com wrote:
 Hi all
 I have written a class using prototype Class object
 and after playing it for a while, I saw that I need to use the with
 keyword in the class members,
 so I can access its members

 here is the relevant part of the class : (the member is _div)

 var JSClass = Class.create ({
      initialize: function(initParams) {

         if (initParams.div)
         {
             *this*._div = $(initParams.div);
         }
         else
         {
             *this*._div = new Element(div);
         }
      },
      // an example of a member function
     setComment: function(msg)
     {
         *with(this)*
 *        {*
 *              *_div.innerHTML = msg;
 *        }*
     }

 });

 is there a way that I can get rid of all these usages of this

 Thanks
 Ran

 --
 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-scriptacul...@googlegroups.com.
 To unsubscribe from this group, send email to 
 prototype-scriptaculous+unsubscr...@googlegroups.com.
 For more options, visit this group 
 athttp://groups.google.com/group/prototype-scriptaculous?hl=en.

-- 
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-scriptacul...@googlegroups.com.
To unsubscribe from this group, send email to 

Re: [Proto-Scripty] Re: using with statement

2010-04-30 Thread Ran Berenfeld
Thanks a lot for your reply T.J
I was partially familiar with this mechanism, and now I know more :)
anyway, let me re-phrase my question
we all know that an event received on a DOM element (i.e button onclick
event for example)
will have the this equals to the DOM element

my question is simple : isn't there a way do define the class member
functions in such a way
that the scope (this) will refer to the object instance ?

Thanks
Ran B

On Fri, Apr 30, 2010 at 9:31 AM, T.J. Crowder t...@crowdersoftware.comwrote:

 Hi,

  is there a way that I can get rid of all these usages of this

 No. `this` is different in Javascript than in some other languages
 with the same keyword, in several ways. One of these is that
 unqualified references like your _div (without anything in front of
 it) are not automatically resolved against property names on `this`;
 all identifier resolution in Javascript is lexically-based, using the
 concept of a scope chain (more below if you're interested). So you
 have to explicitly type `this.` when accessing the properties on
 `this` (just as you have to type `foo.` to access the properties on
 `foo`), or as you've found, you can use `with`. Be aware that using
 `with` has some gotchas that are not obvious. Douglas Crockford
 lists many of these in his with Statement Considered Harmful[1]
 article (I'm not a fan of Considered Harmful articles[2], but
 Crockford lays out the issues fairly well). My point isn't don't use
 it, it's be sure you understand the gotchas when using it.

 About the scope chain and identifier resolution: One of the things I
 love about Javascript is that basically *everything* is an object,
 even if some of the objects are hidden behind the scenes. One of these
 behind-the-scenes objects is the variable object (the binding
 object of the variable environment in the latest spec -- yikes). When
 you declare a variable using `var`, you're adding a *property* to the
 variable object for the current scope. The variable object has
 properties for all `var`s, all functions declared in the scope, and
 (if the scope relates to a function) all named arguments to the
 function. When the step-by-step code within the scope is executing,
 that scope's variable object is at the beginning of the scope chain.
 All unqualified references are first checked against that variable
 object to see if they match a property on it. If they do, that
 property is used; if not, the next variable object in the chain is
 checked; etc.

 Example:

 var x = 1;

 function foo() {
var y = 2;

function bar() {
var z = 3;

alert(x);
alert(y);
alert(z);
}
 }

 We have three scopes there: Global scope, `foo`'s scope, and `bar`'s
 scope. Consequently, we have three variable objects. When code within
 `bar` is being executed, the scope chain consists of `bar`'s variable
 object, followed by `foo`'s, followed by the global variable object.
 When `bar` references `z`, the `z` property is found on the first
 variable object and used. When `bar` references `y`, it's not on the
 first variable object but it is on the second one, so it's used from
 there. Accessing `x` involves going back two variable objects to the
 global one.

 As you can see, `this` doesn't come into it -- it's nowhere on the
 scope chain unless you insert it, which is exactly what `with` does:
 Puts the object you specify at the beginning of the scope chain.

 Now, I called the variable object a behind-the-scenes object. That's
 usually true, but there's an exception: The variable object for the
 global scope is the global object, which on browsers is `window` (more
 accurately, on browsers the global object has a property, `window`, it
 points to itself with). That's why when you declare variables and
 functions at global scope, they magically show up as properties on
 `window`.

 [1] http://yuiblog.com/blog/2006/04/11/with-statement-considered-harmful/
 [2] http://meyerweb.com/eric/comment/chech.html

 HTH,
 --
 T.J. Crowder
 Independent Software Consultant
 tj / crowder software / com
 www.crowdersoftware.com

 On Apr 29, 9:17 am, Ran Berenfeld berenfeld...@gmail.com wrote:
  Hi all
  I have written a class using prototype Class object
  and after playing it for a while, I saw that I need to use the with
  keyword in the class members,
  so I can access its members
 
  here is the relevant part of the class : (the member is _div)
 
  var JSClass = Class.create ({
   initialize: function(initParams) {
 
  if (initParams.div)
  {
  *this*._div = $(initParams.div);
  }
  else
  {
  *this*._div = new Element(div);
  }
   },
   // an example of a member function
  setComment: function(msg)
  {
  *with(this)*
  *{*
  *  *_div.innerHTML = msg;
  *}*
  }
 
  });
 
  is there a way that I can get rid of all these usages of this
 
  Thanks
  Ran
 
  --
  You received 

[Proto-Scripty] Re: using $$

2010-04-19 Thread T.J. Crowder
Hi,

It doesn't seem like you're having any trouble with `$$`, that part's
working fine.

I'm guessing those links don't have an `href` attribute on them. When
you do `alert(item)` in that code, what happens behind the scenes is
that (through a couple of layers) the object's `toString` method ends
up getting called. I don't know whether this behavior is specified
somewhere or not, but on the three browser engines I tried (IE7,
Firefox, Chrome), they all showed the `href` of the anchor, and if
there wasn't one, they gave a blank string. I also tried a div, which
showed something more like what you were expecting.

I'm afraid I don't know what you mean by store it to a timer, so I
can't comment on that. If you post some sample code, happy to take a
look, but your use of `$$` is just fine.

HTH,
--
T.J. Crowder
Independent Software Consultant
tj / crowder software / com
www.crowdersoftware.com


On Apr 19, 9:15 am, Ran Berenfeld berenfeld...@gmail.com wrote:
 Hello
 I tried to use $$ to make flash effect on some a elements in my site

 the code looked like this :

         var itemsArray = $$(a.resultsSummary);
         for (var i=0;i  itemsArray.length;i++)
         {
                 var item = itemsArray[i];
                 alert(item);
                  ...
         }

 however, the alert(item) prints empty string. I would expect
 HtmlAElement or something like this...
 when I do item.style.backgroundColor = yellow it works fine, but
 when I store it to a timer (in order
 to turn it off) it is not working.

 any help ?

 --
 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-scriptacul...@googlegroups.com.
 To unsubscribe from this group, send email to 
 prototype-scriptaculous+unsubscr...@googlegroups.com.
 For more options, visit this group 
 athttp://groups.google.com/group/prototype-scriptaculous?hl=en.

-- 
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-scriptacul...@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.



Re: [Proto-Scripty] Re: using $$

2010-04-19 Thread Ran Berenfeld
Guys
I found the problem (in my code..) and $$ works just fine :)

thank you and sorry for the bother

On Mon, Apr 19, 2010 at 12:48 PM, T.J. Crowder t...@crowdersoftware.comwrote:

 Hi,

 It doesn't seem like you're having any trouble with `$$`, that part's
 working fine.

 I'm guessing those links don't have an `href` attribute on them. When
 you do `alert(item)` in that code, what happens behind the scenes is
 that (through a couple of layers) the object's `toString` method ends
 up getting called. I don't know whether this behavior is specified
 somewhere or not, but on the three browser engines I tried (IE7,
 Firefox, Chrome), they all showed the `href` of the anchor, and if
 there wasn't one, they gave a blank string. I also tried a div, which
 showed something more like what you were expecting.

 I'm afraid I don't know what you mean by store it to a timer, so I
 can't comment on that. If you post some sample code, happy to take a
 look, but your use of `$$` is just fine.

 HTH,
 --
 T.J. Crowder
 Independent Software Consultant
 tj / crowder software / com
 www.crowdersoftware.com


 On Apr 19, 9:15 am, Ran Berenfeld berenfeld...@gmail.com wrote:
  Hello
  I tried to use $$ to make flash effect on some a elements in my site
 
  the code looked like this :
 
  var itemsArray = $$(a.resultsSummary);
  for (var i=0;i  itemsArray.length;i++)
  {
  var item = itemsArray[i];
  alert(item);
   ...
  }
 
  however, the alert(item) prints empty string. I would expect
  HtmlAElement or something like this...
  when I do item.style.backgroundColor = yellow it works fine, but
  when I store it to a timer (in order
  to turn it off) it is not working.
 
  any help ?
 
  --
  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-scriptacul...@googlegroups.com.
  To unsubscribe from this group, send email to
 prototype-scriptaculous+unsubscr...@googlegroups.comprototype-scriptaculous%2bunsubscr...@googlegroups.com
 .
  For more options, visit this group athttp://
 groups.google.com/group/prototype-scriptaculous?hl=en.

 --
 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-scriptacul...@googlegroups.com.
 To unsubscribe from this group, send email to
 prototype-scriptaculous+unsubscr...@googlegroups.comprototype-scriptaculous%2bunsubscr...@googlegroups.com
 .
 For more options, visit this group at
 http://groups.google.com/group/prototype-scriptaculous?hl=en.



-- 
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-scriptacul...@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 form.serialize and multiple selects

2010-03-07 Thread T.J. Crowder
Hi Geoff,

This is actually more of a PHP question than a Prototype one. :-)
Prototype will serialize the multi-select in the standard way, which
results in POST data looking something like this (assuming I've
selected blue and white):

colour_value=bluecolour_value=white

Note how the field name is repeated for each value. (The same sort of
thing happens if you have multiple text inputs with the same name.)

How you deal with it at the server-side depends on your server-side
technology. In PHP, there's a special feature where you can flag up
for the PHP engine that you're going to be getting multiple values for
the name and that you want to handle them as an array: Put [] after
the field name:

select name=colour_value[] size= 2 multiple=multiple

PHP will then automatically combine those values into a zero-based
array called colour_value:

$colour_value = $HTTP_GET_VARS['colour_value'];
echo Count: .sizeof($colour_value);

So you can then loop through them in the normal way.

Don't know how good it is (I'm not much of a PHP guy, you just
happened to hit one of the three or so things I know about PHP --
picked it up because people would post questions with these weird
field names with brackets in them!), but I found an article discussing
this here:
http://www.opensourcetutorials.com/tutorials/Server-Side-Coding/PHP/html-forms-php/page1.html

HTH,
--
T.J. Crowder
Independent Software Consultant
tj / crowder software / com
www.crowdersoftware.com

On Mar 6, 6:55 pm, geoffcox geoffa...@gmail.com wrote:
 Hello

 I cannot seem to get my head round how to deal with multiple selects
 and form.serialize

 I have, say,

 select name=colour_value size= 2 multiple=multiple
 option value=greengreen/option
 option value=blueblue/option
 option value=yellowyellow/option
 option value=whitewhite/option
 /select

 How do select both blue and white and use form.serialize to pass these
 values to a php file which will insert the values into mysql? I have
 seen that I should use colour_value[] but what next?

 Thanks!

 Geoff

-- 
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-scriptacul...@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 form.serialize and multiple selects

2010-03-07 Thread geoffcox
Many thanks for the info and the link!

Cheers

Geoff

-- 
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-scriptacul...@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 drag/drop to trig asp.net code-behind

2010-03-04 Thread TIBO
Hi everybody,

Any help? Do you need more details or can you redirect me in the right
forum section, please? I need - at least - a starting point.

Thanks

-- 
You received this message because you are subscribed to the Google Groups 
Prototype  script.aculo.us group.
To post to this group, send email to prototype-scriptacul...@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 cropping on images and affects

2009-12-17 Thread david
Hi Ralph,

if you want to do the text effect on the 2 differents box on the
exemple you 'll give us ?

In fact I don't understand why you'll need to crop the image ? CSS can
do it for you with the overflow:visible; property.
I perhaps miss something :((
but I think you could do such an effect directly.

--
david


On 15 déc, 20:58, Topsoft Design Studio i...@topsoftweb.com wrote:
 On example I can give of what I mean is found here on the home page of this
 site:

 http://www.carlsonveit.com/

 Ralph Brickley
 Owner

 logo-small
 435 NE Evans St Ste 115
 P.O. Box 510  McMinnville, OR 97128

 (503) 583-1830 Cell  |  (503) 472-7914 Office  |  (800) 986-0276 Fax

  http://www.topsoftweb.com/www.topsoftdesignstudio.com

 From: Topsoft Design Studio [mailto:i...@topsoftweb.com]
 Sent: Tuesday, December 15, 2009 11:44 AM
 To: prototype-scriptaculous@googlegroups.com
 Subject: [Proto-Scripty] Using cropping on images and affects

 I want to cause a few images of text to slide around within a colored box
 div region. When these images slide across the bounding box I want them to
 crop to that back to give the affect they are contained inside the region.

 Does anyone know a good way to set that up so I can use New
 Affect.Move('image'.) and it will auto-crop?

 Ralph Brickley
 Owner

 logo-small
 435 NE Evans St Ste 115
 P.O. Box 510  McMinnville, OR 97128

 (503) 583-1830 Cell  |  (503) 472-7914 Office  |  (800) 986-0276 Fax

  http://www.topsoftweb.com/www.topsoftdesignstudio.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-scriptacul...@googlegroups.com.
 To unsubscribe from this group, send email to
 prototype-scriptaculous+unsubscr...@googlegroups.com.
 For more options, visit this group 
 athttp://groups.google.com/group/prototype-scriptaculous?hl=en.

  image001.png
 5KAfficherTélécharger

--

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-scriptacul...@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 Ajax.Request to fetch an image

2009-12-04 Thread fma
Ok, I see. Someone on the web proposed to encode images in base64 to
be able to fetch them using text answer. Do you think it is a good
idea?

--

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-scriptacul...@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.




Re: [Proto-Scripty] Re: Using Ajax.Request to fetch an image

2009-12-04 Thread Alex McAuley
I can see alot of security issues with that!


Alex Mcauley
http://www.thevacancymarket.com
- Original Message - 
From: fma f...@gbiloba.org
To: Prototype  script.aculo.us prototype-scriptaculous@googlegroups.com
Sent: Friday, December 04, 2009 9:34 AM
Subject: [Proto-Scripty] Re: Using Ajax.Request to fetch an image


 Ok, I see. Someone on the web proposed to encode images in base64 to
 be able to fetch them using text answer. Do you think it is a good
 idea?

 --

 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-scriptacul...@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.


 

--

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-scriptacul...@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.




Re: [Proto-Scripty] Re: Using Ajax.Request to fetch an image

2009-12-04 Thread Peter De Berdt

On 04 Dec 2009, at 10:34, fma wrote:

 Ok, I see. Someone on the web proposed to encode images in base64 to
 be able to fetch them using text answer. Do you think it is a good
 idea?

Let me rephrase what I meant (AJAX wasn't the correct term, you just  
need to rely on asynchronous events and callbacks instead of polling  
all the time):

- Create your image object: new Image();
- Attach an onLoad event handler to that image object
- Assign the .src to the image object. Remember: first define the  
onload handler, then assign the source url
- Then you have a choice: either fire a custom event that you capture  
into another object prototype that does the actual processing or just  
fill in the handler right away


Best regards

Peter De Berdt

--

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-scriptacul...@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 Ajax.Request to fetch an image

2009-12-04 Thread fma
That's what I did, using 'observe' to register the 'load' event.

Not that I had to use stopObserving() to ensure that the callback was
not called several times...

--

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-scriptacul...@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 Ajax.Request and evalJS to load functions on the fly

2009-08-20 Thread T.J. Crowder

Hi,

Can you post a minimal, self-contained example[1] of the problem?

[1] http://proto-scripty.wikidot.com/self-contained-test-page
--
T.J. Crowder
tj / crowder software / com
Independent Software Engineer, consulting services available


On Aug 19, 2:39 pm, Donnie Carvajal donnie.carva...@tfmx.com
wrote:
 HI T.J.,

 Will this work with Ajax.Request?  I changed my script so that it is created 
 instead of defined and I still can't access it using evalJS.

 Donnie



 -Original Message-
 From: prototype-scriptaculous@googlegroups.com 
 [mailto:prototype-scriptacul...@googlegroups.com] On Behalf Of T.J. Crowder
 Sent: Tuesday, August 18, 2009 4:24 PM
 To: Prototype  script.aculo.us
 Subject: [Proto-Scripty] Re: Using Ajax.Request and evalJS to load functions 
 on the fly

 Hi,

 They're accessible from anywhere after they're evaluated, but mind how
 you declare them, because of a bit of a quirk about how they're
 evaluated.  There's a badly misplaced note about this in the
 documentation, at the bottom of the discussion of Ajax.Updater[1].  It
 really should be in the String#evalScripts documentation, and it's on
 my list, but I haven't had a chance to move it.

 [1]http://prototypejs.org/api/ajax/updater

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

 On Aug 18, 8:00 pm, Remah donnie.carva...@tfmx.com wrote:
  I am trying to call a JS file using Ajax.Request that will return a
  javascript function.  This function will be used by code taht will be
  injected into a div.  Is this possible?  It seems like the function is
  accessible within the CallBacks of Ajax.Request, but they are not
  accessible outside.

  Thanks for your help,

  Remah
--~--~-~--~~~---~--~~
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 Ajax.Request and evalJS to load functions on the fly

2009-08-19 Thread Donnie Carvajal

HI T.J.,

Will this work with Ajax.Request?  I changed my script so that it is created 
instead of defined and I still can't access it using evalJS.

Donnie

-Original Message-
From: prototype-scriptaculous@googlegroups.com 
[mailto:prototype-scriptacul...@googlegroups.com] On Behalf Of T.J. Crowder
Sent: Tuesday, August 18, 2009 4:24 PM
To: Prototype  script.aculo.us
Subject: [Proto-Scripty] Re: Using Ajax.Request and evalJS to load functions on 
the fly


Hi,

They're accessible from anywhere after they're evaluated, but mind how
you declare them, because of a bit of a quirk about how they're
evaluated.  There's a badly misplaced note about this in the
documentation, at the bottom of the discussion of Ajax.Updater[1].  It
really should be in the String#evalScripts documentation, and it's on
my list, but I haven't had a chance to move it.

[1] http://prototypejs.org/api/ajax/updater

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


On Aug 18, 8:00 pm, Remah donnie.carva...@tfmx.com wrote:
 I am trying to call a JS file using Ajax.Request that will return a
 javascript function.  This function will be used by code taht will be
 injected into a div.  Is this possible?  It seems like the function is
 accessible within the CallBacks of Ajax.Request, but they are not
 accessible outside.

 Thanks for your help,

 Remah


--~--~-~--~~~---~--~~
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 Ajax.Request and evalJS to load functions on the fly

2009-08-18 Thread T.J. Crowder

Hi,

They're accessible from anywhere after they're evaluated, but mind how
you declare them, because of a bit of a quirk about how they're
evaluated.  There's a badly misplaced note about this in the
documentation, at the bottom of the discussion of Ajax.Updater[1].  It
really should be in the String#evalScripts documentation, and it's on
my list, but I haven't had a chance to move it.

[1] http://prototypejs.org/api/ajax/updater

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


On Aug 18, 8:00 pm, Remah donnie.carva...@tfmx.com wrote:
 I am trying to call a JS file using Ajax.Request that will return a
 javascript function.  This function will be used by code taht will be
 injected into a div.  Is this possible?  It seems like the function is
 accessible within the CallBacks of Ajax.Request, but they are not
 accessible outside.

 Thanks for your help,

 Remah
--~--~-~--~~~---~--~~
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 Ajax.Request and evalJS to load functions on the fly

2009-08-18 Thread Miguel Beltran R.
maybe

http://proto-scripty.wikidot.com/prototype:how-to-load-scripts-dynamically

2009/8/18 Remah donnie.carva...@tfmx.com


 I am trying to call a JS file using Ajax.Request that will return a
 javascript function.  This function will be used by code taht will be
 injected into a div.  Is this possible?  It seems like the function is
 accessible within the CallBacks of Ajax.Request, but they are not
 accessible outside.

 Thanks for your help,

 Remah

 



-- 

Lo bueno de vivir un dia mas
es saber que nos queda un dia menos de vida

--~--~-~--~~~---~--~~
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 Ajax.Updater posts the contain form

2009-08-13 Thread T.J. Crowder

Hi,

The code you included in your message isn't posting any forms; it must
be something else on the page.

Can you produce a minimalist, complete, stand-alone example of the
behavior?  (There's a template here[1] if you like.)  See Step 3 in
this troubleshooting tip[2] on the FAQ for details and rationale.

[1] http://proto-scripty.wikidot.com/self-contained-test-page
[2] http://proto-scripty.wikidot.com/faq#xyzprob

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


On Aug 13, 9:18 am, dpGoose cpzare...@googlemail.com wrote:
 Hi,

 I am using Axaj.Updater to retrieve a message from the server and it
 does do this but it also posts the form the Updater script and
 associated controls are contained in. I have followed the examples on
 the prototype site with modifications for my web server. Why is this
 happening? Here is the relevant code. This response is just a text
 message.

 script type=text/javascript
         function loadit()
         {
                 new Ajax.Updater( 'structureTree', 'Render?s=OrgConfigAjax',
                 {
                         method: 'get',
                         parameters:
                         {
                                 cmd: 'test'
                         }
                  });
         }
 /script
 button onclick=loadit();Click me/button
 div id=structureTreeLoading...
 /div
--~--~-~--~~~---~--~~
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 Ajax.Updater posts the contain form

2009-08-13 Thread Alex McAuley

Can you explain it a bit better?

I dont quite understand what is going on


Alex Mcauley
http://www.thevacancymarket.com
- Original Message - 
From: dpGoose cpzare...@googlemail.com
To: Prototype  script.aculo.us prototype-scriptaculous@googlegroups.com
Sent: Thursday, August 13, 2009 9:18 AM
Subject: [Proto-Scripty] Using Ajax.Updater posts the contain form



 Hi,

 I am using Axaj.Updater to retrieve a message from the server and it
 does do this but it also posts the form the Updater script and
 associated controls are contained in. I have followed the examples on
 the prototype site with modifications for my web server. Why is this
 happening? Here is the relevant code. This response is just a text
 message.

 script type=text/javascript
 function loadit()
 {
 new Ajax.Updater( 'structureTree', 'Render?s=OrgConfigAjax',
 {
 method: 'get',
 parameters:
 {
 cmd: 'test'
 }
 });
 }
 /script
 button onclick=loadit();Click me/button
 div id=structureTreeLoading...
 /div

 
 


--~--~-~--~~~---~--~~
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 Ajax.Updater posts the contain form

2009-08-13 Thread Daniel Rubin

dpGoose wrote:
 Hi,
 
 I am using Axaj.Updater to retrieve a message from the server and it
 does do this but it also posts the form the Updater script and
 associated controls are contained in. I have followed the examples on
 the prototype site with modifications for my web server. Why is this
 happening? Here is the relevant code. This response is just a text
 message.
 
 script type=text/javascript
   function loadit()
   {
   new Ajax.Updater( 'structureTree', 'Render?s=OrgConfigAjax',
   {
   method: 'get',
   parameters:
   {
   cmd: 'test'
   }
});
   }
 /script
 button onclick=loadit();Click me/button
 div id=structureTreeLoading...
 /div
Hi,
you might want to try putting the attribute setting
type=button
in your button-tag.

I assume the snippet you posted is contained in a form, right?
Button-tags are type=submit by default, so clicking the button will
trigger both 'click' and 'submit' events.

Does this help?

Daniel


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Prototype  script.aculo.us group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: Using Ajax.Updater posts the contain form

2009-08-13 Thread T.J. Crowder

 I assume the snippet you posted is contained in a form, right?
 Button-tags are type=submit by default...

Gah!  I read right past that.  Nice catch.

-- T.J.

On Aug 13, 1:21 pm, Daniel Rubin dru...@dimedis.de wrote:
 dpGoose wrote:
  Hi,

  I am using Axaj.Updater to retrieve a message from the server and it
  does do this but it also posts the form the Updater script and
  associated controls are contained in. I have followed the examples on
  the prototype site with modifications for my web server. Why is this
  happening? Here is the relevant code. This response is just a text
  message.

  script type=text/javascript
     function loadit()
     {
             new Ajax.Updater( 'structureTree', 'Render?s=OrgConfigAjax',
             {
                     method: 'get',
                     parameters:
                     {
                             cmd: 'test'
                     }
              });
     }
  /script
  button onclick=loadit();Click me/button
  div id=structureTreeLoading...
  /div

 Hi,
 you might want to try putting the attribute setting
     type=button
 in your button-tag.

 I assume the snippet you posted is contained in a form, right?
 Button-tags are type=submit by default, so clicking the button will
 trigger both 'click' and 'submit' events.

 Does this help?

 Daniel
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Prototype  script.aculo.us group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: Using custom onDrop effect works perfect in FF, breaks in IE

2009-08-11 Thread CSobolewski

I was able to fix this. Line 361 in effects.js was throwing an object
required error. I'm not sure if this is a bug in scriptaculous, or if
it was the way I wrote the function, but commenting out lines 361 and
362 solved the issue for me.


On Aug 10, 5:30 pm, CSobolewski wiglyw...@gmail.com wrote:
 the following code seems to work fine in Firefox, allowing me to drag
 and drop an item, then pick it up a second later and drop it to a new
 area. However in IE, it completely breaks down. The next 21 (or so)
 times I mouse up (only on mouseup, mouse down does not do it, and I
 can mouse down on one div, move to another to mouseup and it will
 create a duplicate on the mouseuped div), a copy of the draggable
 appears in whatever droppable my mouse is over. Once it's done with
 that silliness, all my draggables are broken and do not drag.

 function DropHandler(element,el){
         var newnode  = document.createElement('img');
         var classname = element.className;
         newnode.src=img/+element.id+.jpg;
         $(el).appendChild(newnode);
         newnode.setAttribute(class, classname);
         newnode.setAttribute(className, classname);
         $(element.id).parentNode.removeChild($(element.id));
         newnode.setAttribute('id', element.id);
         new Draggable(newnode.id,{revert:true});

 }
--~--~-~--~~~---~--~~
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 a prototype function in dynamic content.

2009-08-05 Thread Drum


     $(div).update(thereturn);


That did the trick!

It's true that I don't make as much use of prototype as I could or
should. Most of the js/ajax on the site is written from scratch (way
back when I was learning how to use ajax). I added prototype later on
to do some of the 'bells and whistles' stuff. I will certainly take
the time to read the api as I'm sure there are all sorts of things it
could help with on the site.

Many thanks,

Chris
--~--~-~--~~~---~--~~
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 a prototype function in dynamic content.

2009-08-04 Thread T.J. Crowder

Hi,

   if (http_request.readyState == 4) {
 if (http_request.status == 200) {
  document.getElementById('load').innerHTML = 
 ;

You're not using Ajax.Request[1] or Ajax.Updater[2]?

 This is my onSuccess handler, how do
 I apply evalScripts?

DJ and I are talking about a Prototye onSuccess handler for one of the
two features above.

 document.getElementById(div).innerHTML = thereturn;

Your code is setting the innerHTML property directly.  If you just
change that line to use Element#update instead, #update will handle
eval'ing the scripts for you:

$(div).update(thereturn);

Altenately, keep setting innerHTML directly (although #update does
some very handy things for you) and then after doing that, call
String#evalScripts() directly:

document.getElementById(div).innerHTML = thereturn;
thereturn.evalScripts();

String#evalScripts is a method Prototype adds to the String prototype
and so it's available on all strings.  Details here.[4]

Looking at your quoted code, you're not making much use of Prototype
at all -- not even the $() function!  (So much more compact than
document.getElementById.)  I suggest taking an hour to read through
the API docs[5] front-to-back to get an idea of what's on offer.  It
literally takes an hour and saves you no end of time in the long run.
May also be worth reading through some stuff on the unofficial wiki
[6].

[1] http://prototypejs.org/api/ajax/request
[2] http://prototypejs.org/api/ajax/updater
[3] http://prototypejs.org/api/element/update
[4] http://prototypejs.org/api/string/evalScripts
[5] http://prototypejs.org/api
[6] http://proto-scripty.wikidot.com/

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

On Aug 4, 1:22 am, Drum csteph2...@gmail.com wrote:
  if you need to do it yourself, you'd use
  String#evalScripts on the responseText member of the Ajax.Response
  passed into your onSuccess handler.

 Sorry, I still don't understand. This is my onSuccess handler, how do
 I apply evalScripts?

           if (http_request.readyState == 4) {
             if (http_request.status == 200) {
                                  document.getElementById('load').innerHTML = 
 ;
                                  var thereturn = http_request.responseText;
                                  document.getElementById(div).innerHTML = 
 thereturn;
  } else {
                                  alert(error);
             }
     }
--~--~-~--~~~---~--~~
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 a prototype function in dynamic content.

2009-08-03 Thread Drum

 if you need to do it yourself, you'd use
 String#evalScripts on the responseText member of the Ajax.Response
 passed into your onSuccess handler.


Sorry, I still don't understand. This is my onSuccess handler, how do
I apply evalScripts?

  if (http_request.readyState == 4) {
if (http_request.status == 200) {
 document.getElementById('load').innerHTML = ;
 var thereturn = http_request.responseText;
 document.getElementById(div).innerHTML = 
thereturn;
 } else {
 alert(error);
}
}


--~--~-~--~~~---~--~~
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 a prototype function in dynamic content.

2009-08-02 Thread T.J. Crowder

Hi,

I wasn't talking about String#evalScripts function, I was talking
about the evalScripts *option* on Ajax.Updater:
http://prototypejs.org/api/ajax/updater

If you're not using Ajax.Updater, if you're doing the update yourself,
Element#update[1] will eval the scripts for you as part of its
processing.  But if you need to do it yourself, you'd use
String#evalScripts on the responseText member of the Ajax.Response
passed into your onSuccess handler.

[1] http://prototypejs.org/api/element/update

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


On Aug 1, 7:26 pm, Drum csteph2...@gmail.com wrote:
 Ah, now, that's interesting. I did try to use evalScripts, but I
 couldn't find any clear examples of how or where to apply it. I tried
 putting it in the places it seemed logical, but without effect.

 So, ok, I have an HTML page includes an onclick to fetch some content
 which will include scripts. The JS functions to handle this are in an
 external file. Do I put the evalScripts() in

 onclick=getStuff(param, param).evalScipts();

 or do I apply it to the returned text before putting it in innerHTML
 like

 var thereturn = http_request.responseText.evalScripts();
 document.getElementById(div).innerHTML = thereturn;

 I tried both, but couldn't get either to work.

 C

 On 31 July, 11:13, T.J. Crowder t...@crowdersoftware.com wrote:



  Hi,

  You're using the evalScripts option in your ajax call?  Can you
  produce a small, self-contained example[1]?

  [1]http://proto-scripty.wikidot.com/self-contained-test-page

  -- T.J. :-)

  On Jul 31, 1:22 am, Drum csteph2...@gmail.com wrote:

   P.S. I tried with both delete eds[id];  and eds[id] = undefined.
--~--~-~--~~~---~--~~
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 a prototype function in dynamic content.

2009-08-01 Thread Drum

Ah, now, that's interesting. I did try to use evalScripts, but I
couldn't find any clear examples of how or where to apply it. I tried
putting it in the places it seemed logical, but without effect.

So, ok, I have an HTML page includes an onclick to fetch some content
which will include scripts. The JS functions to handle this are in an
external file. Do I put the evalScripts() in

onclick=getStuff(param, param).evalScipts();

or do I apply it to the returned text before putting it in innerHTML
like

var thereturn = http_request.responseText.evalScripts();
document.getElementById(div).innerHTML = thereturn;

I tried both, but couldn't get either to work.

C




On 31 July, 11:13, T.J. Crowder t...@crowdersoftware.com wrote:
 Hi,

 You're using the evalScripts option in your ajax call?  Can you
 produce a small, self-contained example[1]?

 [1]http://proto-scripty.wikidot.com/self-contained-test-page

 -- T.J. :-)

 On Jul 31, 1:22 am, Drum csteph2...@gmail.com wrote:



  P.S. I tried with both delete eds[id];  and eds[id] = undefined.
--~--~-~--~~~---~--~~
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 a prototype function in dynamic content.

2009-07-31 Thread T.J. Crowder

Hi,

You're using the evalScripts option in your ajax call?  Can you
produce a small, self-contained example[1]?

[1] http://proto-scripty.wikidot.com/self-contained-test-page

-- T.J. :-)

On Jul 31, 1:22 am, Drum csteph2...@gmail.com wrote:
 P.S. I tried with both delete eds[id];  and eds[id] = undefined.
--~--~-~--~~~---~--~~
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 a prototype function in dynamic content.

2009-07-30 Thread Drum

Ok, thanks. I think I understand the reasoning here, but I can't get
my actual example to work.

This is the script as it appears in the initially loaded page and also
as it is in the html snippets bought in by ajax.

div id=kwdisp0101some keyword/div

script
if(editor0101){
editor0101.dispose();
editor0101 = undefined;
}
var editor0101;
editor0101 = new Ajax.InPlaceEditor('kwdisp0101','./addkw.php',{size:
17,callback: function(form, value) { return 'oldwd=some
%20keywordidx=section-idmyparam=' + escape(value)}});\n;
/script

The 0101 is an example, I do this for each keyword in the list and
derive the numbers from some php code, net will be 0102, 0103 0201
0202 c. This goes for both the editor var name in the js, and for the
dic id in the HTML.

Have I missed or misunderstood something? (it's been a long day...)






--~--~-~--~~~---~--~~
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 a prototype function in dynamic content.

2009-07-30 Thread T.J. Crowder

Hi,

Really close. :-)  But you're running afoul of how eval handles the
var statement.  (If you'd just left the var statement out entirely, it
probably would have worked thanks to the horror of implicit globals
[1], but you'd be cluttering up the window namespace something
fierce.)  Also,  you're repeating a lot of code.

Instead, I'd suggest declaring a hash of editors on your main page
(not the stuff loaded dynamically) and a function for adding or
replacing one; and may as well wrap those up into just the one global
symbol:

In your main script:
* * * *
var ipeManager = {
editors: {},

addOrReplaceEditor: function(id, url, size, paramstr) {
var eds;

eds = this.editors;

if (eds[id]) {
eds[id].dispose();
eds[id] = undefined; // Or: delete eds[id];
}

eds[id] = new Ajax.InPlaceEditor(
id,
url,
{
size: size,
callback: function(form, value) {
return paramstr + escape(value);
}
}
);
}
};
* * * *

Then the dynamic stuff can be much simpler:
* * * *
div id=kwdisp0101some keyword/div
script
ipeManager.addOrReplaceEditor(
   kwdisp0101,
   './addkw.php',
   17,
   'oldwd=some%20keywordidx=section-idmyparam='
);
/script
* * * *

[1] http://blog.niftysnippets.org/2008/03/horror-of-implicit-globals.html

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


On Jul 30, 5:51 pm, Drum csteph2...@gmail.com wrote:
 Ok, thanks. I think I understand the reasoning here, but I can't get
 my actual example to work.

 This is the script as it appears in the initially loaded page and also
 as it is in the html snippets bought in by ajax.

 div id=kwdisp0101some keyword/div

 script
 if(editor0101){
 editor0101.dispose();
 editor0101 = undefined;}

 var editor0101;
 editor0101 = new Ajax.InPlaceEditor('kwdisp0101','./addkw.php',{size:
 17,callback: function(form, value) { return 'oldwd=some
 %20keywordidx=section-idmyparam=' + escape(value)}});\n;
 /script

 The 0101 is an example, I do this for each keyword in the list and
 derive the numbers from some php code, net will be 0102, 0103 0201
 0202 c. This goes for both the editor var name in the js, and for the
 dic id in the HTML.

 Have I missed or misunderstood something? (it's been a long day...)
--~--~-~--~~~---~--~~
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 a prototype function in dynamic content.

2009-07-30 Thread Drum

Sorry, but it's still not working for me.

I have my main page as it initially loads with this in the HEAD

script language=javascript
type=text/javascript
var ipeManager = {
editors: {},
addOrReplaceEditor: function(id, url, size, paramstr){
var eds;
eds = this.editors;
if (eds[id]) {
eds[id].dispose();
delete eds[id]; // Or: eds[id] = undefined;
}
eds[id] = new Ajax.InPlaceEditor(id,url,{size: size,callback:
function(form, value) {return paramstr + escape(value);}});
}
};
/script

Then, in the body of the document is the keyword list:

div id=kwdisp0101A keyword/div
...a bunch of other stuff...
script
ipeManager.addOrReplaceEditor('kwdisp0101','./addkw.php',
17,'oldwd=A%20keywordidx=subject-idmyparam=');
/script

div id=kwdisp0102Another keyword/div
...a bunch of other stuff...
script
ipeManager.addOrReplaceEditor('kwdisp0102','./addkw.php',
17,'oldwd=A%20keywordidx=subject-idmyparam=');
/script

div id=kwdisp0103Yet another keyword/div
...a bunch of other stuff...
script
ipeManager.addOrReplaceEditor('kwdisp0103','./addkw.php',
17,'oldwd=Yet%20another%20keywordidx=subject-idmyparam=');
/script

The content called in by ajax is basically a copy of the keyword list,
and has exactly the same structure and IDs as the list above.

On loading the initial page it works fine, but when the ajax content
has replaced the original list, it no longer works. No Firebug errors,
no nothing.

Did I miss something out?

--~--~-~--~~~---~--~~
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 a prototype function in dynamic content.

2009-07-26 Thread T.J. Crowder

Hi,

If you replace an element, even if the replacement has the same ID as
the original, you will have toinitialize a new InPlaceEditor.  It
grabs a reference to the element instance, which is different for the
replacement than for the original.  It would be best to *also* remove
the InPlaceEditor for the previous version of the element, so as to
free up memory.

So, say you have this div:

div id='content'
...
p id='editme'Blah blah blah/p
...
/div

And you put an editor on the paragraph:

new Ajax.InPlaceEditor('editme', url);

If you replace it:

$('div').update('p id=editmenew content/p');

...then the previous paragraph element ceases to exist, and there's
nothing to indicate that the new element has an InPlaceEditor.

Instead, remember a reference to the editor when first setting it up:

var editor;
...
editor = new Ajax.InPlaceEditor('editme', url);

...and then destroy it and recreate it when updating:

if (editor) {
editor.dispose();
editor = undefined;
}
$('div').update('p id=editmenew content/p');
editor = new Ajax.InPlaceEditor('editme', url);

That's all inline code, you'll probably want to put some structure
around it, but you get the idea.

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


On Jul 26, 2:25 pm, Drum csteph2...@gmail.com wrote:
 I have a page which include a list of user entered keywords on which I
 want to be able to use Ajax.InPlaceEditor.

 It works fine when the initial page loads, The initial list is in the
 initial HTML and includes the calls to the editor.

 When, however, the div with the list and calls to the editor has been
 written using innerHTML = responseText, it does not work.

 I get no errors in Firebug, but the javascript is not running.

 Any help?
--~--~-~--~~~---~--~~
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 script.aculo.us and prototype for Fade Out.

2009-06-12 Thread mb2000inc

Well, the player is just a simple SWF with a streaming video (there
are no controls) created in Flash using the video component, telling
it where to find the video to play - I purposely left out the controls
in an effort to just have a video intro play.

My Flash development skills are horrible, to say the least - so I
wouldn't know how to go about adding play buttons, ActionScript (to
tell the browser when the video is done), etc... I just thought a
timer with the Script.acul.ous/Prototype Fade Effect was a good way to
go...

If you can think of anything that would help me out, any input would
be appreciated.

Thanks for responding.

-mb

On Jun 12, 3:18 am, T.J. Crowder t...@crowdersoftware.com wrote:
 Hi,

 Frankly, I don't think you'll ever get that to work reliably barring
 receiving a notification from the player that the video has finished
 playing (which would require that you use a specific player, which
 isn't as desireable as just letting the user choose by sending the
 movie data).  There are too many variables -- such as whether the user
 paused the video for a minute to take a phone call, etc.  I wouldn't
 be surprised if some browsers fired the window load event when the
 video was ready to start playing rather than when it finishes copying
 (I know it waits for images, but perhaps some vendors treat movies and
 other long-running content differently), and so network delays in the
 middle that hold up the video would mess up your timing.  Etc.
 Instead, FWIW, I'd recommend revising the UI approach.
 --
 T.J. Crowder
 tj / crowder software / com
 Independent Software Engineer, consulting services available

 On Jun 11, 9:15 pm, mb2000inc mb2000...@gmail.com wrote:



  I have a timer setup on the page, where I have a div tag that's
  playing a 20 second video.  When it's done, the div tag fades out.
  That's the great part... it works locally...

  However, when it's put out to the rest of the network, the timer isn't
  quite right.

  Anyone know how to tweak the timer across multiple browsers on the
  network?  (eventually, my site will go live and I need to have this
  working before the live date)

  Here's the code.

          script type=text/javascript src=js/prototype.js/script
          script type=text/javascript src=js/scriptaculous.js/
  script
          script type=text/javascript
          !--
          var browserName=navigator.appName;
          if (browserName==Microsoft Internet Explorer)
           {
          Event.observe(window, 'load', function() {
                  var fade=setTimeout(fadeout(), 41500);
                  var hide=setTimeout($('DIVNAME').hide(), 42500);
              });

              function fadeout(){
                  new Effect.Opacity(DIVNAME, {duration:1.0, from:1.0,
  to:0.0});
              }
                           }
                           else
                            {
              Event.observe(window, 'load', function() {
                  var fade=setTimeout(fadeout(), 40400);
                  var hide=setTimeout($('DIVNAME').hide(), 41500);
              });

              function fadeout(){
                  new Effect.Opacity(DIVNAME, {duration:1.0, from:1.0,
  to:0.0});
              }
                             }
           //--
          /script

  Anyone know how to tweak the code so it's consistant across the board?
  I have a link, but because it's work related - I can only share that
  link privately.
  Discretion is the key.

  -mb- Hide quoted text -

 - Show quoted text -
--~--~-~--~~~---~--~~
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 script.aculo.us and prototype for Fade Out.

2009-06-12 Thread T.J. Crowder

Hi,

 Well, the player is just a simple SWF with a streaming video...

Ah.  I thought you were just sending the movie data and letting the
user choose how they play it -- the preferred solution, in my book,
since I'm big on individual choice.  (I hate having 18 different
viewers pushed at me.)

I know less about Flash development than you do (don't get me started
on Flash, I'm not a fan), but I know from having been forced to use it
(as a user) on occasion that you can trigger an event via ActionScript
that can be handled in JavaScript.  I'd see what the folks in the
Flash or ActionScript groups have to say, I bet it's not hard.  Then
you wouldn't have to worry about the timing.

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


On Jun 12, 2:02 pm, mb2000inc mb2000...@gmail.com wrote:
 Well, the player is just a simple SWF with a streaming video (there
 are no controls) created in Flash using the video component, telling
 it where to find the video to play - I purposely left out the controls
 in an effort to just have a video intro play.

 My Flash development skills are horrible, to say the least - so I
 wouldn't know how to go about adding play buttons, ActionScript (to
 tell the browser when the video is done), etc... I just thought a
 timer with the Script.acul.ous/Prototype Fade Effect was a good way to
 go...

 If you can think of anything that would help me out, any input would
 be appreciated.

 Thanks for responding.

 -mb

 On Jun 12, 3:18 am, T.J. Crowder t...@crowdersoftware.com wrote:

  Hi,

  Frankly, I don't think you'll ever get that to work reliably barring
  receiving a notification from the player that the video has finished
  playing (which would require that you use a specific player, which
  isn't as desireable as just letting the user choose by sending the
  movie data).  There are too many variables -- such as whether the user
  paused the video for a minute to take a phone call, etc.  I wouldn't
  be surprised if some browsers fired the window load event when the
  video was ready to start playing rather than when it finishes copying
  (I know it waits for images, but perhaps some vendors treat movies and
  other long-running content differently), and so network delays in the
  middle that hold up the video would mess up your timing.  Etc.
  Instead, FWIW, I'd recommend revising the UI approach.
  --
  T.J. Crowder
  tj / crowder software / com
  Independent Software Engineer, consulting services available

  On Jun 11, 9:15 pm, mb2000inc mb2000...@gmail.com wrote:

   I have a timer setup on the page, where I have a div tag that's
   playing a 20 second video.  When it's done, the div tag fades out.
   That's the great part... it works locally...

   However, when it's put out to the rest of the network, the timer isn't
   quite right.

   Anyone know how to tweak the timer across multiple browsers on the
   network?  (eventually, my site will go live and I need to have this
   working before the live date)

   Here's the code.

           script type=text/javascript src=js/prototype.js/script
           script type=text/javascript src=js/scriptaculous.js/
   script
           script type=text/javascript
           !--
           var browserName=navigator.appName;
           if (browserName==Microsoft Internet Explorer)
            {
           Event.observe(window, 'load', function() {
                   var fade=setTimeout(fadeout(), 41500);
                   var hide=setTimeout($('DIVNAME').hide(), 42500);
               });

               function fadeout(){
                   new Effect.Opacity(DIVNAME, {duration:1.0, from:1.0,
   to:0.0});
               }
                            }
                            else
                             {
               Event.observe(window, 'load', function() {
                   var fade=setTimeout(fadeout(), 40400);
                   var hide=setTimeout($('DIVNAME').hide(), 41500);
               });

               function fadeout(){
                   new Effect.Opacity(DIVNAME, {duration:1.0, from:1.0,
   to:0.0});
               }
                              }
            //--
           /script

   Anyone know how to tweak the code so it's consistant across the board?
   I have a link, but because it's work related - I can only share that
   link privately.
   Discretion is the key.

   -mb- Hide quoted text -

  - Show quoted text -


--~--~-~--~~~---~--~~
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 fade and appear on the same object concurrently, interrupt one another, unwanted behavior

2009-05-22 Thread T.J. Crowder

Hi,

You can use effects queues[1] to handle that.  Either use one queue
for all of your effects, or -- and I think this probably makes more
sense if I understand what you're doing -- use a queue for each
element, so the fade can't stomp on the appear.

So where you're creating the appear effect, you might do something
like this:

// Assuming 'element' has a reference to the extended element, and
// that your elements have ids (if they don't, use element.identify()
// instead of element.id)
new Effect.Appear(element, {
queue: {
scope:  element.id,
position:   'end'
}
});

...and then when you're creating the fade, it's exactly the same
except for the effect you use.  That way, the fade will allow the
appear to complete before it starts doing the fade, but by using the
element's ID as the queue scope, you don't prevent other effects on
other elements.

[1] http://wiki.github.com/madrobby/scriptaculous/effect-queues

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

On May 21, 7:44 pm, BB Design bradbans...@gmail.com wrote:
 Here is my test page:

 http://secure.bbdesign.com/lenoradame/history.asp

 You can see that if you mouse over and off the links at the top, the
 appear/fade work nicely. But if you do it too quickly, you get
 undesirable results. Sometimes the effect is temporarily disabled,
 until you mouseover some other link, then it works again. Here is how
 I'm doing it:

 a onmouseover=$('navicon1').appear({duration: 0.3}); return false;
 onmouseout=$('navicon1').fade({duration: 0.3}); return false;
 href=index.aspHOME/a

 Is there some way to make it so the effects won't interrupt each
 other? My Javascript skills are not what they should be.

 Thanks!
 -Brad
--~--~-~--~~~---~--~~
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 fade and appear on the same object concurrently, interrupt one another, unwanted behavior

2009-05-22 Thread BB Design

Thanks, perfect! Can that be done with my inline code, though?

Or if not, for some reason I am having trouble understanding how to
setup the effect in a Javascript and then call the effect with
onmouseover and onmouseout. What would be the equivalent of a
Javascript version of the same thing as this:

a onmouseover=$('navicon1').appear({duration: 0.3}); return false;
onmouseout=$('navicon1').fade({duration: 0.3}); return false;
href=index.aspHOME/a

I'm really getting confused as to how to name things, reference
elements, etc.

Thanks!
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Prototype  script.aculo.us group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: using fade and appear on the same object concurrently, interrupt one another, unwanted behavior

2009-05-22 Thread BB Design

For example, this is what I'm trying, but it isn't working:

script type=text/javascript language=javascript
function navicon1on {
effect.appear('navicon1', {duration: 0.3});
}
function navicon1off {
effect.fade('navicon1', {duration: 0.3});
}
/script

div class=posnavtext1a onmouseover=navicon1on();
onmouseout=navicon1off(); href=index.aspHOME/a/div
div id=navicon1 class=posnavicon1 style=display: none;img
src=art/ic_homeHover.gif alt=Home width=71 height=55
border=0 //div

--~--~-~--~~~---~--~~
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 fade and appear on the same object concurrently, interrupt one another, unwanted behavior

2009-05-22 Thread Walter Lee Davis

I would give each navigation element an ID, but that's just me.  
Working with the HTML you have here, you could do this to hook into  
TJ's elegant code.

$$('div. posnavtext1 a').each(function(element){
   element.observe('mouseover',function(evt){
 new Effect.Appear(element, {
   queue: {
  scope:  element.identify(),
  position:   'end'
}
 });
   });
   element.observe('mouseout',function(evt){
 new Effect.Fade(element, {
   queue: {
  scope:  element.identify(),
  position:   'end'
}
 });
   });
});

Get rid of all the onwhatever event handlers in your HTML. They aren't  
needed any more.

Walter

On May 22, 2009, at 9:07 AM, BB Design wrote:


 For example, this is what I'm trying, but it isn't working:

 script type=text/javascript language=javascript
   function navicon1on {
   effect.appear('navicon1', {duration: 0.3});
   }
   function navicon1off {
   effect.fade('navicon1', {duration: 0.3});
   }
 /script

 div class=posnavtext1a onmouseover=navicon1on();
 onmouseout=navicon1off(); href=index.aspHOME/a/div
 div id=navicon1 class=posnavicon1 style=display: none;img
 src=art/ic_homeHover.gif alt=Home width=71 height=55
 border=0 //div

 


--~--~-~--~~~---~--~~
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 fade and appear on the same object concurrently, interrupt one another, unwanted behavior

2009-05-22 Thread T.J. Crowder

Hi,

 Thanks, perfect!

No worries!

 Can that be done with my inline code, though?

It _can_, yes, just put the queue parameter in your existing options
blocks.  But as Walter indicates, you really don't need to be using
inline event attributes anymore.

 For example, this is what I'm trying, but it isn't working:

 script type=text/javascript language=javascript
 function navicon1on {
 effect.appear('navicon1', {duration: 0.3});
 }
 function navicon1off {
 effect.fade('navicon1', {duration: 0.3});
 }
 /script

A couple of things.  Case (capitalization) is significant in
JavaScript, so you need to be sure you're using exactly the right
capitalization.  Script.aculo.us makes each effect available in two
ways:  A constructor that takes the element to act on as a parameter,
or as a method of an extended element.  You're using the constructor
there, and script.aculo.us' constructors and Effect namespace are both
initially capped (the first letter is capitalized).  You're also
missing the new operator.  It might help to go back and review the
demos and examples on the script.aculo.us documentation site[1].

Looking at the source of the page you linked, I think you might want
to review your use of IDs and class names.  IDs are for uniquely
identifying elements; class names are for marking elements (usually
more than one) that share common characteristics.  You seem to be
using class names a bit like IDs.

 I'm really getting confused as to how to name things, reference
 elements, etc.

It's pretty straightforward.  There are basically three ways to
reference an element:

1. By its ID, if it has one.  You're already doing that in your code:

$('navicon1').appear({duration: 0.3});

That's referencing an element with the ID 'navicon1', using
Prototype's $ function.  So you're on the way.  Read up on $ here[2]

2. Via CSS selectors.  Prototype provides very powerful CSS selector
functionality.  For instance, suppose you want to get an array of
every element in your document with the CSS class foo.  You can use
Prototype's $$ function[3] to do that:

var a = $$('.foo');

The syntax supported is (nearly all of) CSS3, so that's pretty
powerful stuff.

3. By its relationship with some other element you already have a
reference to.  So say you have this structure:

div
spanBlah blah blah/span
spanHumdee doo/span
/div

Now, suppose you have a reference to the first span element, and you
want to refer to the span that follows it.  You can do that using DOM
traversal, and Prototype provides some very nice DOM traversal stuff,
including the Element#next function[4], which finds the next sibling
of the element that matches the selector you give it.  Since the spans
in the example above are siblings (they have the same parent),
assuming 's1' is a reference to the first span, I can get a reference
to the second span using s1.next():

var s2 = s1.next('span');

This is useful for when you know the relationship between elements,
and if you know that relationship is stable.  There's also
Element#down to find descendant elements, Element#up to find
ancestors, etc.

Let's bring a few of these things together.  Suppose I have this
structure which I'll call an item:

div class='item'
a href='...'Blah blah/a
div class='icon'.../div
/div

And let's suppose the structure of each item is stable; I'm not likely
to change it without expecting to make code changes as well.  Suppose
there are several items on a page, and I want the link within each
item to do something to the div that follows it.  I *could* put an
onclick attribute on each link, but that's a lot of work and I'm
lazy.  Instead, I'll use Prototype's dom:loaded event (which happens
when the page has been loaded, but without waiting for the images to
load -- so, sooner than window.load):

script type='text/javascript'
document.observe('dom:loaded', function() {
// ...my code here...
});
/script

Okay, so now I have code being called when the page loads.  What do I
want to do?  First, find all the item links:

var links;
links = $$('.item a');

(That selector matches any anchor within an element with the item
class.)

Then I want to loop through the array of links and hook up a couple of
event handlers on each of them.  I could use a normal for loop and
there's nothing wrong with that, but Prototype extends arrays with a
function called Enumerable#each[5] which makes things like this pretty
easy:

links.each(function(link) {
// ...my code here...
});

#each will call the function you give it for each item in the array,
passing it as the first parameter to the function.  It's just a
shorthand way of writing this:

var n, link;
for (n = 0; n  links.length; ++n) {
link = links[n];
// ...my code here...
}

So, for each link I want to set up a couple of event handlers -- one
for mouseover, another for mouseout.  I can use 

[Proto-Scripty] Re: using fade and appear on the same object concurrently, interrupt one another, unwanted behavior

2009-05-22 Thread BB Design

This is over my head at the moment, so I will need to start out small
and work my way up. I'm trying to do something really simple, which is
just to add the queue to my inline event. If I can be confident that
that works, then I'll try the no-inline-event method. Here is my
existing code:

div class=posnavtext1a onmouseover=$('navicon1').appear
({duration: 0.3}); return false; onmouseout=$('navicon1').fade
({duration: 0.3}); return false; href=index.aspHOME/a/div
div id=navicon1 class=posnavicon1 style=display: none;img
src=art/ic_homeHover.gif alt=Home width=71 height=55
border=0 //div

I tried adding this:

, queue:{scope: element.identify(), position: 'end'}

...in various places, but I can't get it to work. The effect doesn't
happen at all, it must be a syntax problem? What must I do to simply
implement the queue, by sending the event to the end of the queue?
--~--~-~--~~~---~--~~
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 fade and appear on the same object concurrently, interrupt one another, unwanted behavior

2009-05-22 Thread T.J. Crowder

Hi,

You want to use a queue for each icon; since your inline code already
use the icon element's ID literally, you can just supply that
literally as the scope.

, queue: {scope: 'navicon1', position: 'end'}

E.g., in this case, you don't need Element#identify.  (The reason it
wasn't working was that element was not defined anywhere.)
--
T.J. Crowder
tj / crowder software / com
Independent Software Engineer, consulting services available


On May 22, 5:14 pm, BB Design bradbans...@gmail.com wrote:
 This is over my head at the moment, so I will need to start out small
 and work my way up. I'm trying to do something really simple, which is
 just to add the queue to my inline event. If I can be confident that
 that works, then I'll try the no-inline-event method. Here is my
 existing code:

 div class=posnavtext1a onmouseover=$('navicon1').appear
 ({duration: 0.3}); return false; onmouseout=$('navicon1').fade
 ({duration: 0.3}); return false; href=index.aspHOME/a/div
 div id=navicon1 class=posnavicon1 style=display: none;img
 src=art/ic_homeHover.gif alt=Home width=71 height=55
 border=0 //div

 I tried adding this:

 , queue:{scope: element.identify(), position: 'end'}

 ...in various places, but I can't get it to work. The effect doesn't
 happen at all, it must be a syntax problem? What must I do to simply
 implement the queue, by sending the event to the end of the queue?
--~--~-~--~~~---~--~~
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 prototype tabs within a prototype horizontal accordion

2009-05-03 Thread Alex McAuley

Use firebug... it states the error as Element Does not exist ...so i would 
say reverse the load order for the 2 classes and it should be ok

change your code to somehting like the following


Event.observe(window, 'load', function() {
 var tabs = new tabset('container'); // name of div to crawl for tabs and 
panels
  tabs.autoActivate($('tab_first')); // name of tab to auto-select if none 
exists in the url
var topAccordion = new 
accordion('horizontal_container', {
classNames : {
toggle : 'horizontal_accordion_toggle',
toggleActive : 
'horizontal_accordion_toggle_active',
content : 'horizontal_accordion_content'
},
defaultSize : {
width : 400
},
direction : 'horizontal'
});

var bottomAccordion = new 
accordion('vertical_container');

var nestedVerticalAccordion = new 
accordion('vertical_nested_container', 
{
  classNames : {
toggle : 'vertical_accordion_toggle',
toggleActive : 
'vertical_accordion_toggle_active',
content : 'vertical_accordion_content'
}
});

// Open first one
bottomAccordion.activate($$('#vertical_container 
.accordion_toggle')[0]);

// Open second one
topAccordion.activate($$('#horizontal_container 
.horizontal_accordion_toggle')[2]);
}); // end event listener/script




- Original Message - 
From: jwtdesign irishwhis...@gmail.com
To: Prototype  script.aculo.us prototype-scriptaculous@googlegroups.com
Sent: Saturday, May 02, 2009 8:01 PM
Subject: [Proto-Scripty] using prototype tabs within a prototype horizontal 
accordion



 Hello, I am trying to build a website that uses the horizontal
 accordion framework downloaded from http://www.stickmanlabs.com/accordion/
 and then within the panel content, I am trying to use a tab set-up.
 However, the two prototype libraries seem to be conflicting. If I get
 rid of one, the tabs will work but the accordion is broken. If I get
 rid of the other, the accordion will work but the tabs will not. I'd
 really appreciate any help!

 Here is the link with the tabs working in the first panel. But as you
 can see, the accordion is broken:
 http://www.jwtdesign.com/clients/tsnav/ts_index_test.html

 Please help!

 
 


--~--~-~--~~~---~--~~
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 prototype tabs within a prototype horizontal accordion

2009-05-03 Thread Jeff Talley
Thanks so much for the reply! but unfortunately, that error has been there
since the beginning. So, my thoughts are that the error is not affecting the
functionality (or non-functionality) of the accordion. Is there any way to
combine both prototype scripts into one or strip out what I don't need? I'm
so sorry to ask these questionsthis is just all a little new to me.
Thanks for all your help thus far!

On Sun, May 3, 2009 at 4:11 AM, Alex McAuley 
webmas...@thecarmarketplace.com wrote:


 Use firebug... it states the error as Element Does not exist ...so i
 would
 say reverse the load order for the 2 classes and it should be ok

 change your code to somehting like the following


 Event.observe(window, 'load', function() {
  var tabs = new tabset('container'); // name of div to crawl for tabs and
 panels
  tabs.autoActivate($('tab_first')); // name of tab to auto-select if none
 exists in the url
var topAccordion = new
 accordion('horizontal_container', {
classNames : {
toggle :
 'horizontal_accordion_toggle',
toggleActive :
 'horizontal_accordion_toggle_active',
content :
 'horizontal_accordion_content'
},
defaultSize : {
width : 400
},
direction : 'horizontal'
});

var bottomAccordion = new
 accordion('vertical_container');

var nestedVerticalAccordion = new
 accordion('vertical_nested_container',
 {
  classNames : {
toggle :
 'vertical_accordion_toggle',
toggleActive :
 'vertical_accordion_toggle_active',
content :
 'vertical_accordion_content'
}
});

// Open first one
bottomAccordion.activate($$('#vertical_container
 .accordion_toggle')[0]);

// Open second one
topAccordion.activate($$('#horizontal_container
 .horizontal_accordion_toggle')[2]);
 }); // end event listener/script




 - Original Message -
 From: jwtdesign irishwhis...@gmail.com
 To: Prototype  script.aculo.us 
 prototype-scriptaculous@googlegroups.com
 Sent: Saturday, May 02, 2009 8:01 PM
 Subject: [Proto-Scripty] using prototype tabs within a prototype horizontal
 accordion


 
  Hello, I am trying to build a website that uses the horizontal
  accordion framework downloaded from
 http://www.stickmanlabs.com/accordion/
  and then within the panel content, I am trying to use a tab set-up.
  However, the two prototype libraries seem to be conflicting. If I get
  rid of one, the tabs will work but the accordion is broken. If I get
  rid of the other, the accordion will work but the tabs will not. I'd
  really appreciate any help!
 
  Here is the link with the tabs working in the first panel. But as you
  can see, the accordion is broken:
  http://www.jwtdesign.com/clients/tsnav/ts_index_test.html
 
  Please help!
 
  
 


 



-- 
Irishwhiskey is Jeffrey Talley

“As a cure for worrying, work is better than whiskey.” —Ralph Waldo Emerson

--~--~-~--~~~---~--~~
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 this.arrayname to add data to an array not working

2009-04-30 Thread IMBI-Indie-Portal

Hi, Yes I found some good info by Mr Crockford and friends a few weeks
ago.
I was looking up some info on advanced AJAX security techniques.

Found these pages:
http://www.webdirections.org/resources/douglas-crockford-ajax-security/
Some interesting presentation slides...
and from there a link to:
http://www.codinghorror.com/blog/archives/001175.html

Unfortunatly I wont be buying any more books untill I get a job.
Have an Interview with a 'recruiting crowd' today [friday].
Fingers crossed..

I have now replaced the XML in the Q and A app with JSON, and, added
caching for the fetched q and a sets.
Works like a dream.

Any thoughts yet on why the bind() function won't work within the
Ajax.Request??

Not important, just curious..
Mabye its an unexpected bug in the prototype AJAX implementation?
Is there another group/list where that question might be more
appropriate?

Thanks Again!
Gilbert R..
--~--~-~--~~~---~--~~
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 this.arrayname to add data to an array not working

2009-04-28 Thread ColinFine

Your problem is that you are making (reasonable but wrong) assumptions
about what 'this' is bound to.

Inside a function (which is the only level of scope that Javascript
has), 'this' is not set, and therefore refers to the global object
(the window) unless you have done something explicit to cause it to be
bound to something else.

The usual case is that you call the function using the 'method'
invocation, in which case 'this' is bound to the object on which the
method was called.

I'm not certain what 'this' will be bound to in your example, ('new'
confuses me) but I think it is the new Ajax.Request object you are
creating, Whatever, it will *not* be whatever 'this' is bound to
outside the call.

Prototype has a method Function#bind for setting 'this' explicitly in
a function.


Colin Fine
--~--~-~--~~~---~--~~
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 this.arrayname to add data to an array not working

2009-04-28 Thread T.J. Crowder

Hi Gilbert,

Building on what Colin said, I'd suggest reading up a bit on
JavaScript and this, it's not quite the same as some other languages
you might be familiar with.  If you don't already have a good
JavaScript book, I'd recommend JavaScript: The Definitive Guide by
David Flanagan[1][2].  I've done a couple of blog entries[3][4] that
may help as well.

You have a couple of options for solving the problem.  One is to use
Function#bind[5] as Colin said.  You can do that with a named
function, or even with your current anonymous function by wrapping the
whole thing in () and putting .bind(this) at the end of it:

* * * *
var url = path-to-php-script-sid=+Math.random();
var req = new Ajax.Request(url, {
method: 'get',
contentType: 'application/xml',
onComplete: (function(transport) {
var res = transport.responseXML;
var cap_nodes = res.getElementsByTagName('group');
for(i=0; i  cap_nodes.length; i++){
this.cap_questions.push(cap_nodes[i].childNodes
[0].nodeValue);
}).bind(this)
}
});
* * * *

...but that's pretty awkward to read.  (The parens may or may not be
necessary; I'd include them for clarity if nothing else.)
Alternately, you can make the handler a function you define elsewhere
and just use in the request:

* * * *
// Somewhere in your class definition
handler: function(transport) {
 var res = transport.responseXML;
 var cap_nodes = res.getElementsByTagName('group');
 for(i=0; i  cap_nodes.length; i++){
 this.cap_questions.push(cap_nodes[i].childNodes
[0].nodeValue);
 }
},

// Where you want to use it
var url = path-to-php-script-sid=+Math.random();
var req = new Ajax.Request(url, {
method: 'get',
contentType: 'application/xml',
onComplete: this.handler.bind(this)
}
});
* * * *

But if you really want to define it inline, you can just make use of
the fact that it's already a closure and you don't need Function#bind
at all -- just declare a variable and set its value to 'this', and
then use that variable within the closure:

* * * *
var self = this; // For use within the closure below
var url = path-to-php-script-sid=+Math.random();
var req = new Ajax.Request(url, {
method: 'get',
contentType: 'application/xml',
onComplete: function(transport) {
var res = transport.responseXML;
var cap_nodes = res.getElementsByTagName('group');
for(i=0; i  cap_nodes.length; i++){
self.cap_questions.push(cap_nodes[i].childNodes
[0].nodeValue);
}
}
});
* * * *

If you're not sure what I mean by closure and how that works,
Flanagan[1][2] covers it a bit and I've written a bit about it[6][7].

(BTW:  In my examples above, I've declared 'res' and 'cap_nodes' as
vars within the function.  Your example didn't do that, and so they
become globals[8], which will almost certainly give you trouble at
some point.)

[1] http://www.oreilly.com/catalog/jscript5/
[2] http://www.amazon.com/dp/0596101996
[3] http://blog.niftysnippets.org/2008/03/mythical-methods.html
[4] http://blog.niftysnippets.org/2008/04/you-must-remember-this.html
[5] http://prototypejs.org/api/function/bind
[6] http://blog.niftysnippets.org/2008/02/closures-are-not-complicated.html
[7] http://blog.niftysnippets.org/2008/03/closures-by-example.html
[8] http://blog.niftysnippets.org/2008/03/horror-of-implicit-globals.html

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

On Apr 27, 5:28 pm, IMBI-Indie-Portal imbil...@tpg.com.au wrote:
 Thanks T.J.

 I probably should have been more specific.

 I'm actually building a Q and A Captcha, not a Logger. I used that as
 an example.

 The issue is, I am using proto's Ajax.Request and I'm running that
 code within the 'onComplete: function(transport){ callback }' and this
 is executing within a method which get an array of questions from a
 database.
 Another method then creates a select list and renders it to the page.

 I have found that if I declare a var using the 'this.arrayName' before
 running the Ajax.Request I can load the array OK.

 What is strange, is that I can then do 'this.ArrayName  = var;' and
 populate the objects array whilst I'm still in the  'onComplete
 callback'.

 Why is it that I cant load the this,arrayName as shown, but it lets be
 're-value it'??

 Here is a sample of the code: some var declarations are Not show for
 simplicity...

 var qArr = this.cap_questions; // I CREATE THE USABLE VAR WORKAROUND
 HERE 
 var url = path-to-php-script-sid=+Math.random();
 var req = new Ajax.Request( url, {      // I USE THE var = req TO MAKE
 JSLINT HAPPY ??
         method: 'get', contentType: 'application/xml', onComplete: function
 (transport) {
                 res = transport.responseXML; cap_nodes = 
 res.getElementsByTagName
 ('group');
                 for(i=0; i  cap_nodes.length; i++){
                         qArr.push(cap_nodes[i].childNodes[0].nodeValue);
                 

[Proto-Scripty] Re: Using this.arrayname to add data to an array not working

2009-04-28 Thread IMBI-Indie-Portal

Hi! Thanks T.J and Colin.

So Far So Good!

I stayed with the 'inline method', to save code.

I could Not get the bind() to work within the Ajax.Request though??
I tried it as T.J showed, and several other ways.
Firebug reported different errors.
Suggested method for inline returned (' missing } from property
statement') with parenthes ')' and
syntax errors without them.
Trying in other positions had similar errors..

One odd bit of behaviour noted though.
After populating the arrays and after exiting the Ajax.functions, when
I did 'alert(this.cap_questions) before the method finished only got a
blank result, not undefined, just blank.
I figured that self = this is like using the PHP  operator which
binds the new var to the original?
I even tried to alert(self.cap_questions) and got the same blank
result.
Yet, the arrays where populated as expected?? I guess part of the game
is having faith in what your doing!

I used the 'var self = this;'  Worked like a dream - thanks.

I did use the bind() in a few other places, like inside some
setTimeout's - where I wrap in a function() as per LINT methods..

I definately learnt a few new things tonight. Much appretiated. I
relate a lot to my PHP Classes and basic JS knowledge, but I'll have
to do some homework on Prototype Classes and Js Classes and Objects.
My Js function days are over. Classes from now on..

The second issue about calling one method from within another resolved
itself using the bind().

I also did a quick test, regarding what you said about 'global vars'.
I set a var in one method and tested for in in the next one that runs,
but it returned 'undefined'..
I did tidy up the vars as you suggested though!

I'll study the links that you gave me to see if I can undeestand how
globals (declared vars) run their scope in Js classes.
I think thats the key issue with all od this, scope..

I know that globals can be a bad thing as per ADSafe specs..

I'm going to be re-writing most of my JS into classes now, so you may
hear from me again on classes if I get stuck..

I have another problem with prototype that I want to ask about, but as
its not related so I'll start a new thread tommorow.
Its bedtime now here in Oz..

Thanks again for your prompt help. This is a great group.
Signing Off - Gilbert R
--~--~-~--~~~---~--~~
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 this.arrayname to add data to an array not working

2009-04-27 Thread T.J. Crowder

Hi,

Your Logger class, as given, will work fine:

var l = new Logger();
l.write(Testing);
l.write(One);
l.write(Two);
l.write(Three);

The result of the above would be that the 'log' array would be:

[Testing, One, Two, Three]

 I have had to use the following in my method that updates the array.

That workaround is not necessary.  If this code works:

var qArr = this.cap_questions;// create a var as the array //
for(blah blah){
var q = // set-up the value //
qArr.push(q);
}
this.cap_questions = qArr; // restore the classes array value with

...then this code works:

for(blah blah){
var q = // set-up the value //
this.cap_questions.push(q);
}

I suspect if you give us a more complete example -- including direct
quotes of where you're using your class (the above are clearly edited
examples) -- we'll be able to tell you what you're doing wrong.  My
guess would be that it relates to how you're calling your class's
instance methods.

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

On Apr 27, 2:05 pm, Imbi Rehling imbil...@tpg.com.au wrote:
 Hello to all, my first post to this group!
 I am new to OOP in JavaScript and have written my first Js Class using
 prototype.js..
 On the 'Learn pages' at prototypejs.org the example for
 'Classes-Inheritance' shows the following..

 var Logger = Class.create({
   initialize: function() {
     // this is the right way to do it:
 this.log = [];
   },
   write: function(message) {
     this.log.push(message);
   }

 });

 For some reason I can't seem to add to the array using 'this.arrayName'.
 I have tried also this.arrayName[i] = value;
 I initialize the array using the method shown above
 I have had to use the following in my method that updates the array. I have
 several methods that will update arrays, and will probably have to use the
 same in those. It will mean two lines of extra code for each method!!
 .

     var qArr = this.cap_questions;    // create a var as the array //
     for(blah blah){
         var q = // set-up the value //
         qArr.push(q);
     }
     this.cap_questions = qArr; // restore the classes array value with
 updated var //

 Does anyone have an explanation for this, or is it a bug??
 If its a bug, should it be reported at the site??
 Thanks in advance..  Gilbert
--~--~-~--~~~---~--~~
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 this.arrayname to add data to an array not working

2009-04-27 Thread IMBI-Indie-Portal

Thanks T.J.

I probably should have been more specific.

I'm actually building a Q and A Captcha, not a Logger. I used that as
an example.

The issue is, I am using proto's Ajax.Request and I'm running that
code within the 'onComplete: function(transport){ callback }' and this
is executing within a method which get an array of questions from a
database.
Another method then creates a select list and renders it to the page.

I have found that if I declare a var using the 'this.arrayName' before
running the Ajax.Request I can load the array OK.

What is strange, is that I can then do 'this.ArrayName  = var;' and
populate the objects array whilst I'm still in the  'onComplete
callback'.

Why is it that I cant load the this,arrayName as shown, but it lets be
're-value it'??

Here is a sample of the code: some var declarations are Not show for
simplicity...

var qArr = this.cap_questions; // I CREATE THE USABLE VAR WORKAROUND
HERE 
var url = path-to-php-script-sid=+Math.random();
var req = new Ajax.Request( url, {  // I USE THE var = req TO MAKE
JSLINT HAPPY ??
method: 'get', contentType: 'application/xml', onComplete: function
(transport) {
res = transport.responseXML; cap_nodes = 
res.getElementsByTagName
('group');
for(i=0; i  cap_nodes.length; i++){
qArr.push(cap_nodes[i].childNodes[0].nodeValue);
}
this.cap_questions = qArr; // HERE IT LETS ME RE-DECLARE THIS
OBJECTS VALUE?
}
});

If I try to declare the VAR within the callback it won't work either,
Has to be before the new Ajax.Request.
I checked with 'typeof' and it returns 'undefined'

I have another problem as well.

How can I call a method within another method, like in PHP.

Using 'this.methodName() does not seem to work.
After completion of one methods db retrieval, I do a check for state,
and would like to call a method within the working method.
The idea worked (as functions) before I re-wrote the whole idea into
a  single class.
I want the class to be as dynamic as possible, and dont want to have
to add more intelect to the pages code.
This will be a publicly available App, so I'm trying to make it as
simple as possible to setup.

Thanks again for the Quick HELP. Its much appreciated!
Cheers, Gilbert R..
--~--~-~--~~~---~--~~
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 Ajax.Responders onCreate to modify HTTP POST params

2009-03-03 Thread Alex Mcauley

you could addMethods the whole ajax class and add your own parameters ..

see here :
http://www.prototypejs.org/api/class/addMethods

and add them at that point...

This would be one solution

Regards
Alex



- Original Message - 
From: Cameron McCloud cameron.mccl...@gmail.com
To: Prototype  script.aculo.us prototype-scriptaculous@googlegroups.com
Sent: Monday, March 02, 2009 1:42 PM
Subject: [Proto-Scripty] Using Ajax.Responders onCreate to modify HTTP POST 
params



 Hi,

 I want to be able to intercept every AJAX call in Prototype and modify
 the POST parameters sent to the server. I've created an Ajax.Responder
 for this using onCreate. It does intercept the call, and I see the
 parameters modified in FireBug, but the modified parameters aren't
 sent to the server. The documentation does say that the onCreate is
 called after the parameters are processed - does this mean that I
 can't modify them?

 Is there a better way to do this?

 BTW, the reason I want to modify the parameters is to add an extra one
 to do with authentication in  Rails.

 Cam.

 
 


--~--~-~--~~~---~--~~
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 Prototype functions on load: Difficulties with IE

2009-02-20 Thread T.J. Crowder

Hi,

Sounds like you're new to Prototype - welcome!

When working with Prototype DOM extensions, you have to use $() to get
the element unless you got it from a Prototype method (in which case,
Prototype has already done it for you).  Here's why:
http://prototypejs.org/learn/extensions

So just change

document.body.update('Foo');

to

$(document.body).update('Foo');

(But do read the link, so you know why.)

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

On Feb 20, 10:51 am, lacco schlichting@googlemail.com wrote:
 Hi!
 I just tried to use prototype for writing Foo into document's body
 (in fact, I just broke down a little more complex code into this). But
 the IE doesn't find the document.body.update function (in Firefox, all
 works perfect):

 html
   head
     script src=/javascripts/prototype-1.6.0.3.js type=text/
 javascript/script
     script type=text/javascript
       Event.observe(window, 'load', function(){
             document.body.update('Foo');
       });
     /script
   /head
   body/body
 /html

 Am I using the correct DOM event on IE, or which other mistake is in
 my code?

 Thank you!
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Prototype  script.aculo.us group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: Using the appear effect with IE7 yields crappy-looking text

2009-02-19 Thread javamaasai

hey,

Yes i looked at it [alpher.js]
Event.observe(window, 'load', page_loaded_alpha);

function page_loaded_alpha(evt) {
if($('firstTimeAlphaLink')) {
$('firstTimeAlphaLink').onclick=show_first_time_alpha_form;
}

if($('alphaRegisterBack')) {
$('alphaRegisterBack').onclick=show_initial_alpha_page;
}
}

function show_first_time_alpha_form() {
$('firstTimeAlphaLink').onclick=;
//  $('addEmailToWaitListForm').removeClassName
('paddedAddEmailToWaitListForm');
//  Effect.Fade('initialFormsArea', { duration: 0.9, queue: 'front' });
//  Effect.Appear('alphaRegistrationFormsArea', { duration: 0.9, queue:
'end' });
//  $('alphaRegistrationFormsArea').style.opacity=1;
$('alphaRegisterBack').onclick=show_initial_alpha_page;
$('initialFormsArea').style.display = 'none';
$('alphaRegistrationFormsArea').style.display = 'block';
}

function show_initial_alpha_page() {
$('alphaRegisterBack').onclick=;
//  Effect.Fade('alphaRegistrationFormsArea', { duration: 0.9, queue:
'front' });
//  Effect.Appear('initialFormsArea', { duration: 0.9, queue: 'end' });
//  $('initialFormsArea').style.opacity=1;
//  $('addEmailToWaitListForm').addClassName
('paddedAddEmailToWaitListForm');
$('firstTimeAlphaLink').onclick=show_first_time_alpha_form;
//  //$('firstTimeAlphaLink').style.display=none;
//  //$('firstTimeAlphaLink').style.display=block;
//  $('firstTimeAlphaLink').style.opactiy=1;

$('alphaRegistrationFormsArea').style.display = 'none';
$('initialFormsArea').style.display = 'block';
}

initially did the above eliminating one issue after another, at start
just showing next div with minimum  'block' / 'none'. i think the
problem is with the effect function from scriptaculo.
analyzing it now. But creating a basic fade in/  fade out function is
not hard if resolving the issue might take long: but still infinate
love for scriptaculo now we try making it better.

Also why have:

$('firstTimeAlphaLink').style.display=none;
$('firstTimeAlphaLink').style.display=block;

just curious...
[be patient].

Isaac

javamaasai, Africa, Kenya

On Feb 19, 12:39 am, jack7890 jackgr...@gmail.com wrote:
 Hi,

 I'm using the scriptaculous fade and appear effects together to swap
 in new content in an area of my website.  So first I call the fade
 effect to remove the old content, and then I call the appear effect to
 bring in the new content.

 This works perfectly in Firefox, but in IE7, the text in the newly-
 appeared region looks terrible.  The problem is particularly bad for
 italicized text.

 I've searched around online for a solution to this, and some people
 indicated that setting a background color for the wrapper div would
 solve the problem.  But I have tried this and it does not help.

 Here is an example of what I'm talking 
 about:http://www.scribnia.com/main/alphawelcome

 To see the problem, using IE7, click the First time visiting as an
 alpha user? Create your account. link.  Then click the back
 button.  You will see that the new text in IE7 looks terrible
 (particularly the italicized text).

 Can anyone lend any advice?  It would be much appreciated.  I'm
 copying the JS I'm using below, in case that is helpful:

 Event.observe(window, 'load', page_loaded_alpha);

 function page_loaded_alpha(evt) {
         if($('firstTimeAlphaLink')) {
                 $('firstTimeAlphaLink').onclick=show_first_time_alpha_form;
                 }

         if($('alphaRegisterBack')) {
                 $('alphaRegisterBack').onclick=show_initial_alpha_page;
                 }
         }

 function show_first_time_alpha_form() {
         $('firstTimeAlphaLink').onclick=;
         $('addEmailToWaitListForm').removeClassName
 ('paddedAddEmailToWaitListForm');
         Effect.Fade('initialFormsArea', { duration: 0.9, queue: 'front' });
         Effect.Appear('alphaRegistrationFormsArea', { duration: 0.9, queue:
 'end' });
         $('alphaRegistrationFormsArea').style.opacity=1;
         $('alphaRegisterBack').onclick=show_initial_alpha_page;
         }

 function show_initial_alpha_page() {
         $('alphaRegisterBack').onclick=;
         Effect.Fade('alphaRegistrationFormsArea', { duration: 0.9, queue:
 'front' });
         Effect.Appear('initialFormsArea', { duration: 0.9, queue: 'end' });
         $('initialFormsArea').style.opacity=1;
         $('addEmailToWaitListForm').addClassName
 ('paddedAddEmailToWaitListForm');
         $('firstTimeAlphaLink').onclick=show_first_time_alpha_form;
         $('firstTimeAlphaLink').style.opactiy=1;

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

[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: 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: 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: 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: using Ajax.Responders with multiple ajax requests

2009-02-06 Thread gilpster

Thank you for your help crowder.  When i said It's as if the
ajax.responders onComplete method isn't called. I meant that i really
thought that it wasn't - i.e. just a turn of phrase.

you're right the commented out loadPage request was only commented out
because it wasn't working.

I've changed the code as you suggested and it works fine now.  I
didn't realise all that stuff about writing over the original object
and losing the reference.

Anyway, it's sorted now, thanks for the direction

kenneth


ajaxPageTimer = new __ajaxTimer('ajaxPageTimerBox',100);

Ajax.Responders.register({
  onCreate: function(){
if (!ajaxPageTimer.animating)   ajaxPageTimer.startAnimation();
  },
  onComplete: function(){
ajaxPageTimer.stopAnimation();
  }
});


var mainPages = Array();
var myRequests = new Object;

function loadPages(pageSource, page){
var url;
var i = 1;
loadPage();
function loadPage() {
url = incfiles/main + i + .php;
myRequests[i] = new Ajax.Request(url,   {
onSuccess: function(transport){
mainPages[i] = url;
pasteMainContent.defer(transport.responseText, 
i);
i++;
if (imenu.num+1)   loadPage(); //so 
this is faux asyncronous
}
});
}
}
--~--~-~--~~~---~--~~
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 setStyle to change background-image

2009-02-04 Thread david

Hi Eric,

why not using the global background parameter?
try following exemple which work on FF and IE (at least):

$('myDiv').setStyle({background:'transparent url(wait.png)'});

--
david

On 3 fév, 20:48, Walter Lee Davis wa...@wdstudio.com wrote:
 The thing is, it doesn't evaluate each parameter to see which method  
 you've used. If your first element is not quoted, it will assume  
 camelCase throughout, and if it is, then it will assume 'parameter-
 name' throughout instead.

 Walter

 On Feb 3, 2009, at 1:44 PM, Eric wrote:

  Documentation says Element.setStyle should accept both casing (dom-
  like (with-dashes) and javascript like (withCamelCase) but it looks
  like none of them work for this property...
--~--~-~--~~~---~--~~
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 Ajax.Responders with multiple ajax requests

2009-02-03 Thread T.J. Crowder

Hi,

 It's as if the
 ajax.responders onComplete method isn't called.

Sorry, this is one of my pet peeves:  Surely it would take seconds to
modify your code to find out for sure whether it is, rather than
speculating?  ;-)

 however it does not work with synchronous
 requests.

I don't see any synchronous requests in the code you quoted.
Ajax.Request defaults to asynchronous unless you specify
asynchronous: false in the options.  Synchronous requests are a very
bad idea; they completely freeze the UI of most browsers, so you're
best off continuing to leave the option out.

 any idea what i'm doing wrong?

Looking at that code, what if you have more than one request running
at a time?  (And you do, in the code you posted, assuming menu.num is
at least 2.)  Since you're using a global for the timer, Request A can
create a timer that gets started, then Request B starts a second timer
(overwriting the reference to the one created by Request A), then
Request A completes and clears Request B's timer -- Request A's timer
is left in limbo.  You might want to only create the timer if it
hasn't already been created, and in the complete callback, use the
counter maintained by Prototype (discussed on the responders page[1])
to decide whether to stop it.  Or use your own counter within the
timer, whatever route you want to go.  I think if you look into those
issues a bit, the answer's probably somewhere in that area.

[1] http://prototypejs.org/api/ajax/responders

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

On Feb 2, 3:41 pm, gilpster kennethgil...@hotmail.com wrote:
 Hi everyone, hoping for a gentle ride:

 I mostly program actionscript rather than javascript, so although the
 syntax is similar i get a little stuck now and then.

 I'm using the global ajax.responders method to start an animation
 whenever an ajax request is made, and stop the animation upon
 completion of the request.  however it does not work with synchronous
 requests. The onSuccess method of my ajax requests work as they
 should, however the timer continues to animate.  It's as if the
 ajax.responders onComplete method isn't called.

 any idea what i'm doing wrong?

 thx

 kenneth

 Ajax.Responders.register({
   onCreate: function(){
         ajaxPageTimer = new __ajaxTimer('ajaxPageTimerBox',100);
         ajaxPageTimer.startAnimation();
   },
   onComplete: function(){
         ajaxPageTimer.stopAnimation();
   }

 });

 var mainPages = Array();
 var myRequests = new Object;

 function loadPages(pageSource, page)    {
         var url;
         var i = 1;
         //loadPage();
         function loadPage()     {
                 url = incfiles/main + i + .php;
                 myRequests[i] = new Ajax.Request(url,   {
                 onSuccess: function(transport){
                                 mainPages[i] = url;
                                 
 pasteMainContent.defer(transport.responseText, i);
                                 i++;
                                 if (imenu.num+1)    loadPage();     //so 
 this is faux asyncronous
                 }
                 });
         }

 }


--~--~-~--~~~---~--~~
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 setStyle to change background-image

2009-02-03 Thread Richard Quadling

2009/2/3 Eric lefauv...@gmail.com:

 Hi,

 I have a div and I'd like to set its background image style using the
 object format.

 I tried without success the following things:

 $('mydiv').setStyle({'backgroundImage':'wait.gif'});
 $('mydiv').setStyle({'backgroundImage':'url(wait.gif)'});
 $('mydiv').setStyle({'background-image':'wait.gif'});
 $('mydiv').setStyle({'background-image':'url(wait.gif)'});

 It doesn't rise any error but doesn't set the background either.

 The only working way I found until now is using the string format
 parameter.
 This one works:
 $('mydiv').setStyle('background-image:url(wait.gif);'});

 I really would like to use the object form, which is working for other
 style properties on the very same object.
 (ex: $('mydiv').setStyle({'left':xpos+'px','top':ypos+'px'}); )

 Am I missing something here?

 Thanks for any hint.

 Eric
 


The attribute name should not be in quotes ...

$(element).setStyle({   backgroundColor: '#900',   fontSize: '12px' });

so ...

$('mydiv').setStyle({backgroundImage:url(waitgif)});


-- 
-
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: Using setStyle to change background-image

2009-02-03 Thread Richard Quadling

2009/2/3 Richard Quadling rquadl...@googlemail.com:
 2009/2/3 Eric lefauv...@gmail.com:

 Hi,

 I have a div and I'd like to set its background image style using the
 object format.

 I tried without success the following things:

 $('mydiv').setStyle({'backgroundImage':'wait.gif'});
 $('mydiv').setStyle({'backgroundImage':'url(wait.gif)'});
 $('mydiv').setStyle({'background-image':'wait.gif'});
 $('mydiv').setStyle({'background-image':'url(wait.gif)'});

 It doesn't rise any error but doesn't set the background either.

 The only working way I found until now is using the string format
 parameter.
 This one works:
 $('mydiv').setStyle('background-image:url(wait.gif);'});

 I really would like to use the object form, which is working for other
 style properties on the very same object.
 (ex: $('mydiv').setStyle({'left':xpos+'px','top':ypos+'px'}); )

 Am I missing something here?

 Thanks for any hint.

 Eric
 


 The attribute name should not be in quotes ...

 $(element).setStyle({   backgroundColor: '#900',   fontSize: '12px' });

 so ...

 $('mydiv').setStyle({backgroundImage:url(waitgif)});


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


Sorry for the typo ...

wait.gif

not

waitgif

-- 
-
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: Using setStyle to change background-image

2009-02-03 Thread Eric

2009/2/3 Richard Quadling rquadl...@googlemail.com:
 The attribute name should not be in quotes ...

Thanks for the reply Richard,

But I also tried without the quotes, which are optional (except for
'background-image' since in contains a dash).
Documentation says Element.setStyle should accept both casing (dom-
like (with-dashes) and javascript like (withCamelCase) but it looks
like none of them work for this property...

I would really like to use object format in order to set many
parameters in one call without doing heavy string processing (I may
have to do it on up to 2000+ DOM objects when page is loaded...).

Any idea about what I am missing?

--~--~-~--~~~---~--~~
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 JSON/AJAX for more than just scalar data.

2009-01-28 Thread Gabriel Gilini
Just make sure that your server returns data with one of the following
content-types: application/ecmascript, application/javascript,
application/x-ecmascript, application/x-javascript, text/ecmascript,
text/javascript, text/x-ecmascript, or text/x-javascript
as explained in the API: http://www.prototypejs.org/api/ajax/options

Gabriel Gilini

www.usosim.com.br
gabr...@usosim.com.br
gabr...@souagil.com.br


On Wed, Jan 28, 2009 at 12:34 PM, Richard Quadling rquadl...@googlemail.com
 wrote:


 Hi.

 Currently I use AJAX to send POST requests and receive JSON encoded
 data which is magically supplied as an object to me by Prototype in
 the onSuccess handler.

 I can then examine the data and process it as I need to.

 So far so good.

 I now need to do something I don't know how to do.

 The processing I mentioned above is essentially a switch statement
 which determines the processing I want. The specific case then
 extracts the parameters from the JSON object and calls the appropriate
 method/function with the extracted params. More functionality means
 more editing of this 1 function.

 What I want to achieve is a way to have my server supply the call that
 is to be made and when the response arrives at the client, it is just
 executed, without me having to decode it first.

 I want to have a shrink wrapped set of classes which are communicated
 with, essentially by the server.

 A simplistic example.

 Client performs some user interface action (clicks a button, drop down,
 etc.).
 This initiates an AJAX call to get some data.
 The server responds with the data using JSON.
 The onSuccess handler decodes the data client side and calls the
 appropriate functions to handle the response.

 I want this to become

 Client performs some user interface action (clicks a button, drop down,
 etc.).
 This initiates an AJAX call to get some data.
 The server responds with the data using JSON and the code required to
 handle the data.
 The onSuccess handler just runs the code.

 This will allow me to incrementally add functionality to the client as
 they move around the site.

 Regards,

 Richard Quadling.





 --
 -
 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: Using JSON/AJAX for more than just scalar data.

2009-01-28 Thread Ryan Gahl
More specifically, make sure it returns javascript (not just the data), and
uses on of those content types...

There is a pattern that should cover your needs, call JSONP (JSON with
padding), Google jsonp for more info. Basically, you have your server
endpoint setup to return json data (as normal), but then add a check for a
querystring parameter called something like jsonp. The value of that
parameter then becomes the name of a function call that the server wraps the
json data in.

So, a normal request to http://localhost/somePage

returns json:

{foo: bar}

But adding the jspnp parameter to the request (
http://localhost/somePage?jsonp=someFunction)

returns javascript+json...

someFunction({foo: bar});


Note that this requires the someFunction function to be at the global
scope level.

There are many ways to skin this cat, really. JSONP is one of the simpler
examples.



On Wed, Jan 28, 2009 at 8:47 AM, Gabriel Gilini gabr...@usosim.com.brwrote:

 Just make sure that your server returns data with one of the following
 content-types: application/ecmascript, application/javascript,
 application/x-ecmascript, application/x-javascript, text/ecmascript,
 text/javascript, text/x-ecmascript, or text/x-javascript
 as explained in the API: http://www.prototypejs.org/api/ajax/options

 Gabriel Gilini

 www.usosim.com.br
 gabr...@usosim.com.br
 gabr...@souagil.com.br



 On Wed, Jan 28, 2009 at 12:34 PM, Richard Quadling 
 rquadl...@googlemail.com wrote:


 Hi.

 Currently I use AJAX to send POST requests and receive JSON encoded
 data which is magically supplied as an object to me by Prototype in
 the onSuccess handler.

 I can then examine the data and process it as I need to.

 So far so good.

 I now need to do something I don't know how to do.

 The processing I mentioned above is essentially a switch statement
 which determines the processing I want. The specific case then
 extracts the parameters from the JSON object and calls the appropriate
 method/function with the extracted params. More functionality means
 more editing of this 1 function.

 What I want to achieve is a way to have my server supply the call that
 is to be made and when the response arrives at the client, it is just
 executed, without me having to decode it first.

 I want to have a shrink wrapped set of classes which are communicated
 with, essentially by the server.

 A simplistic example.

 Client performs some user interface action (clicks a button, drop down,
 etc.).
 This initiates an AJAX call to get some data.
 The server responds with the data using JSON.
 The onSuccess handler decodes the data client side and calls the
 appropriate functions to handle the response.

 I want this to become

 Client performs some user interface action (clicks a button, drop down,
 etc.).
 This initiates an AJAX call to get some data.
 The server responds with the data using JSON and the code required to
 handle the data.
 The onSuccess handler just runs the code.

 This will allow me to incrementally add functionality to the client as
 they move around the site.

 Regards,

 Richard Quadling.





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




 



-- 
Ryan Gahl
CEO
Nth Penguin, LLC
http://www.nthpenguin.com
--
WebWidgetry.com / MashupStudio.com
Future Home of the World's First Complete Web Platform
--
Inquire: 1-920-574-2218
Blog: http://www.someElement.com
LinkedIn Profile: http://www.linkedin.com/in/ryangahl

--~--~-~--~~~---~--~~
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 JSON/AJAX for more than just scalar data.

2009-01-28 Thread Ryan Gahl
Ugh... I had a lot of typos there. Excuse me as I drink my morning coffee
here :)



On Wed, Jan 28, 2009 at 9:16 AM, Ryan Gahl ryan.g...@gmail.com wrote:

 More specifically, make sure it returns javascript (not just the data), and
 uses on of those content types...

 There is a pattern that should cover your needs, call JSONP (JSON with
 padding), Google jsonp for more info. Basically, you have your server
 endpoint setup to return json data (as normal), but then add a check for a
 querystring parameter called something like jsonp. The value of that
 parameter then becomes the name of a function call that the server wraps the
 json data in.

 So, a normal request to http://localhost/somePage

 returns json:

 {foo: bar}

 But adding the jspnp parameter to the request (
 http://localhost/somePage?jsonp=someFunction)

 returns javascript+json...

 someFunction({foo: bar});


 Note that this requires the someFunction function to be at the global
 scope level.

 There are many ways to skin this cat, really. JSONP is one of the simpler
 examples.




 On Wed, Jan 28, 2009 at 8:47 AM, Gabriel Gilini gabr...@usosim.com.brwrote:

 Just make sure that your server returns data with one of the following
 content-types: application/ecmascript, application/javascript,
 application/x-ecmascript, application/x-javascript, text/ecmascript,
 text/javascript, text/x-ecmascript, or text/x-javascript
 as explained in the API: http://www.prototypejs.org/api/ajax/options

 Gabriel Gilini

 www.usosim.com.br
 gabr...@usosim.com.br
 gabr...@souagil.com.br



 On Wed, Jan 28, 2009 at 12:34 PM, Richard Quadling 
 rquadl...@googlemail.com wrote:


 Hi.

 Currently I use AJAX to send POST requests and receive JSON encoded
 data which is magically supplied as an object to me by Prototype in
 the onSuccess handler.

 I can then examine the data and process it as I need to.

 So far so good.

 I now need to do something I don't know how to do.

 The processing I mentioned above is essentially a switch statement
 which determines the processing I want. The specific case then
 extracts the parameters from the JSON object and calls the appropriate
 method/function with the extracted params. More functionality means
 more editing of this 1 function.

 What I want to achieve is a way to have my server supply the call that
 is to be made and when the response arrives at the client, it is just
 executed, without me having to decode it first.

 I want to have a shrink wrapped set of classes which are communicated
 with, essentially by the server.

 A simplistic example.

 Client performs some user interface action (clicks a button, drop down,
 etc.).
 This initiates an AJAX call to get some data.
 The server responds with the data using JSON.
 The onSuccess handler decodes the data client side and calls the
 appropriate functions to handle the response.

 I want this to become

 Client performs some user interface action (clicks a button, drop down,
 etc.).
 This initiates an AJAX call to get some data.
 The server responds with the data using JSON and the code required to
 handle the data.
 The onSuccess handler just runs the code.

 This will allow me to incrementally add functionality to the client as
 they move around the site.

 Regards,

 Richard Quadling.





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




 



 --
 Ryan Gahl
 CEO
 Nth Penguin, LLC
 http://www.nthpenguin.com
 --
 WebWidgetry.com / MashupStudio.com
 Future Home of the World's First Complete Web Platform
 --
 Inquire: 1-920-574-2218
 Blog: http://www.someElement.com
 LinkedIn Profile: http://www.linkedin.com/in/ryangahl




-- 
Ryan Gahl
CEO
Nth Penguin, LLC
http://www.nthpenguin.com
--
WebWidgetry.com / MashupStudio.com
Future Home of the World's First Complete Web Platform
--
Inquire: 1-920-574-2218
Blog: http://www.someElement.com
LinkedIn Profile: http://www.linkedin.com/in/ryangahl

--~--~-~--~~~---~--~~
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 JSON/AJAX for more than just scalar data.

2009-01-28 Thread Richard Quadling

2009/1/28 Ryan Gahl ryan.g...@gmail.com:
 Ugh... I had a lot of typos there. Excuse me as I drink my morning coffee
 here :)



 On Wed, Jan 28, 2009 at 9:16 AM, Ryan Gahl ryan.g...@gmail.com wrote:

 More specifically, make sure it returns javascript (not just the data),
 and uses on of those content types...

 There is a pattern that should cover your needs, call JSONP (JSON with
 padding), Google jsonp for more info. Basically, you have your server
 endpoint setup to return json data (as normal), but then add a check for a
 querystring parameter called something like jsonp. The value of that
 parameter then becomes the name of a function call that the server wraps the
 json data in.

 So, a normal request to http://localhost/somePage

 returns json:

 {foo: bar}

 But adding the jspnp parameter to the request
 (http://localhost/somePage?jsonp=someFunction)

 returns javascript+json...

 someFunction({foo: bar});


 Note that this requires the someFunction function to be at the global
 scope level.

 There are many ways to skin this cat, really. JSONP is one of the simpler
 examples.



Nice one Ryan.

So, Serverside with no JSONP param does nothing extra.

echo json_encode($a_Results);;

With JSONP param, ...

echo $_POST['JSONP'] . '(' . json_encode($a_Results) . ')';

Is that it? Seems really simple. So I must have misunderstood
something along the way.


 On Wed, Jan 28, 2009 at 8:47 AM, Gabriel Gilini gabr...@usosim.com.br
 wrote:

 Just make sure that your server returns data with one of the following
 content-types: application/ecmascript, application/javascript,
 application/x-ecmascript, application/x-javascript, text/ecmascript,
 text/javascript, text/x-ecmascript, or text/x-javascript
 as explained in the API: http://www.prototypejs.org/api/ajax/options

 Gabriel Gilini

 www.usosim.com.br
 gabr...@usosim.com.br
 gabr...@souagil.com.br


 On Wed, Jan 28, 2009 at 12:34 PM, Richard Quadling
 rquadl...@googlemail.com wrote:

 Hi.

 Currently I use AJAX to send POST requests and receive JSON encoded
 data which is magically supplied as an object to me by Prototype in
 the onSuccess handler.

 I can then examine the data and process it as I need to.

 So far so good.

 I now need to do something I don't know how to do.

 The processing I mentioned above is essentially a switch statement
 which determines the processing I want. The specific case then
 extracts the parameters from the JSON object and calls the appropriate
 method/function with the extracted params. More functionality means
 more editing of this 1 function.

 What I want to achieve is a way to have my server supply the call that
 is to be made and when the response arrives at the client, it is just
 executed, without me having to decode it first.

 I want to have a shrink wrapped set of classes which are communicated
 with, essentially by the server.

 A simplistic example.

 Client performs some user interface action (clicks a button, drop down,
 etc.).
 This initiates an AJAX call to get some data.
 The server responds with the data using JSON.
 The onSuccess handler decodes the data client side and calls the
 appropriate functions to handle the response.

 I want this to become

 Client performs some user interface action (clicks a button, drop down,
 etc.).
 This initiates an AJAX call to get some data.
 The server responds with the data using JSON and the code required to
 handle the data.
 The onSuccess handler just runs the code.

 This will allow me to incrementally add functionality to the client as
 they move around the site.

 Regards,

 Richard Quadling.





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








 --
 Ryan Gahl
 CEO
 Nth Penguin, LLC
 http://www.nthpenguin.com
 --
 WebWidgetry.com / MashupStudio.com
 Future Home of the World's First Complete Web Platform
 --
 Inquire: 1-920-574-2218
 Blog: http://www.someElement.com
 LinkedIn Profile: http://www.linkedin.com/in/ryangahl



 --
 Ryan Gahl
 CEO
 Nth Penguin, LLC
 http://www.nthpenguin.com
 --
 WebWidgetry.com / MashupStudio.com
 Future Home of the World's First Complete Web Platform
 --
 Inquire: 1-920-574-2218
 Blog: http://www.someElement.com
 LinkedIn Profile: http://www.linkedin.com/in/ryangahl

 




-- 
-
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: Using JSON/AJAX for more than just scalar data.

2009-01-28 Thread Ryan Gahl
Heh... nope, you got it. Just don't forget to include the semicolon at the
end when you return the jsonp version.



On Wed, Jan 28, 2009 at 9:37 AM, Richard Quadling
rquadl...@googlemail.comwrote:


 2009/1/28 Ryan Gahl ryan.g...@gmail.com:
  Ugh... I had a lot of typos there. Excuse me as I drink my morning coffee
  here :)
 
 
 
  On Wed, Jan 28, 2009 at 9:16 AM, Ryan Gahl ryan.g...@gmail.com wrote:
 
  More specifically, make sure it returns javascript (not just the data),
  and uses on of those content types...
 
  There is a pattern that should cover your needs, call JSONP (JSON with
  padding), Google jsonp for more info. Basically, you have your server
  endpoint setup to return json data (as normal), but then add a check for
 a
  querystring parameter called something like jsonp. The value of that
  parameter then becomes the name of a function call that the server wraps
 the
  json data in.
 
  So, a normal request to http://localhost/somePage
 
  returns json:
 
  {foo: bar}
 
  But adding the jspnp parameter to the request
  (http://localhost/somePage?jsonp=someFunction)
 
  returns javascript+json...
 
  someFunction({foo: bar});
 
 
  Note that this requires the someFunction function to be at the global
  scope level.
 
  There are many ways to skin this cat, really. JSONP is one of the
 simpler
  examples.
 
 

 Nice one Ryan.

 So, Serverside with no JSONP param does nothing extra.

 echo json_encode($a_Results);;

 With JSONP param, ...

 echo $_POST['JSONP'] . '(' . json_encode($a_Results) . ')';

 Is that it? Seems really simple. So I must have misunderstood
 something along the way.

 
  On Wed, Jan 28, 2009 at 8:47 AM, Gabriel Gilini gabr...@usosim.com.br
  wrote:
 
  Just make sure that your server returns data with one of the following
  content-types: application/ecmascript, application/javascript,
  application/x-ecmascript, application/x-javascript, text/ecmascript,
  text/javascript, text/x-ecmascript, or text/x-javascript
  as explained in the API: http://www.prototypejs.org/api/ajax/options
 
  Gabriel Gilini
 
  www.usosim.com.br
  gabr...@usosim.com.br
  gabr...@souagil.com.br
 
 
  On Wed, Jan 28, 2009 at 12:34 PM, Richard Quadling
  rquadl...@googlemail.com wrote:
 
  Hi.
 
  Currently I use AJAX to send POST requests and receive JSON encoded
  data which is magically supplied as an object to me by Prototype in
  the onSuccess handler.
 
  I can then examine the data and process it as I need to.
 
  So far so good.
 
  I now need to do something I don't know how to do.
 
  The processing I mentioned above is essentially a switch statement
  which determines the processing I want. The specific case then
  extracts the parameters from the JSON object and calls the appropriate
  method/function with the extracted params. More functionality means
  more editing of this 1 function.
 
  What I want to achieve is a way to have my server supply the call that
  is to be made and when the response arrives at the client, it is just
  executed, without me having to decode it first.
 
  I want to have a shrink wrapped set of classes which are communicated
  with, essentially by the server.
 
  A simplistic example.
 
  Client performs some user interface action (clicks a button, drop
 down,
  etc.).
  This initiates an AJAX call to get some data.
  The server responds with the data using JSON.
  The onSuccess handler decodes the data client side and calls the
  appropriate functions to handle the response.
 
  I want this to become
 
  Client performs some user interface action (clicks a button, drop
 down,
  etc.).
  This initiates an AJAX call to get some data.
  The server responds with the data using JSON and the code required to
  handle the data.
  The onSuccess handler just runs the code.
 
  This will allow me to incrementally add functionality to the client as
  they move around the site.
 
  Regards,
 
  Richard Quadling.
 
 
 
 
 
  --
  -
  Richard Quadling
  Zend Certified Engineer :
  http://zend.com/zce.php?c=ZEND002498r=213474731
  Standing on the shoulders of some very clever giants!
 
 
 
 
 
 
 
 
  --
  Ryan Gahl
  CEO
  Nth Penguin, LLC
  http://www.nthpenguin.com
  --
  WebWidgetry.com / MashupStudio.com
  Future Home of the World's First Complete Web Platform
  --
  Inquire: 1-920-574-2218
  Blog: http://www.someElement.com
  LinkedIn Profile: http://www.linkedin.com/in/ryangahl
 
 
 
  --
  Ryan Gahl
  CEO
  Nth Penguin, LLC
  http://www.nthpenguin.com
  --
  WebWidgetry.com / MashupStudio.com
  Future Home of the World's First Complete Web Platform
  --
  Inquire: 1-920-574-2218
  Blog: http://www.someElement.com
  LinkedIn Profile: http://www.linkedin.com/in/ryangahl
 
  
 



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

 



-- 
Ryan Gahl
CEO
Nth Penguin, LLC
http://www.nthpenguin.com
--
WebWidgetry.com / MashupStudio.com
Future Home of the 

[Proto-Scripty] Re: Using class variables from callbacks.

2009-01-07 Thread T.J. Crowder

Hi David,

JavaScript handles this differently from other languages you may be
familiar with.  It's set by the calling code; it's not in any way
intrinsic to the function itself.

Here are a couple of links; the first is a general (and I hope
thorough) explanation of what's happening and how to deal with it; the
second is a how to specific to Prototype (on the unofficial
Prototype  script.aculo.us wiki):

http://blog.niftysnippets.org/2008/04/you-must-remember-this.html
http://proto-scripty.wikidot.com/prototype:how-to-hooking-events#BoundExample

HTH,
--
T.J. Crowder
tj / crowder software / com

On Jan 7, 4:24 am, David da...@reflashed.com wrote:
 I'm having a problem where I can't access variables of the main class
 from callbacks.  It seems like I should have to use a keyword like
 parent or something, but that didn't work.  Any thoughts on this?

 //Sample Code
 var Controller = Class.create({
   initialize: function() {
     //This variable is the problem
     this.busy = true;
     new Ajax.Request(this.AJAX_SUBMIT_PAGE,
     {
       method:'post',
       parameters: params,
       onSuccess: this.HandleResponse
     });

 },

   HandleResponse: function(transport){
     //Returns undefined
     alert(this.busy);
   }

 });


--~--~-~--~~~---~--~~
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 Event.observe and checking for childNodes in a parent

2008-12-18 Thread Alex Mcauley

I would look at the observe in a different way ...

by that i mean observe the element that you are hovering not the whole 
window  this way the event will bubble up the DOM and can be stopped as 
bubbling goes up the document not down.. this is a quick and dirty tooltips 
script i wrote a few weeks ago which does the same thing you are trying to 
do

 tooltips : function() {
  $$(tooltipClass+' div').invoke('observe', 'mouseover', function(event) 
{event.stop();});
  $$(tooltipClass+' img').invoke('observe', 'mouseover', function(event) 
{event.stop();});
$$(tooltipClass).invoke('observe', 'mouseover', function(event) {
if($$(invokedTooltipClass).length = 1) {
 return;
}

var text=$(this).down(0).innerHTML;
if(text=='') {
 return;
}
   var width=(text.length*10)+'px';

   var x=Event.pointerX(event)-30;// horizontal (Left to Right)
   var y=Event.pointerY(event)+20; // vertical (Top to Bototm)

   var el = new Element('div', { 'class': 'tt','style' : 
'display:none;position:absolute;top:'+y+'px;left:'+x+'px;z-index:;max-width:300px;'
 
 }).update('div style=float:right;width:22px;margin-left:6px;img 
src=/resources/includes/images/help.png //div'+text);
   $(this).insert(el);
   Effect.Appear(el);
var att=this;
   Event.stop(event);

   $$(tooltipClass).invoke('observe', 'mouseout', function(event) {
$$('.tt').each(function(elem) {
  Effect.Fade(elem);
  $(elem).remove();
});
   });
 });
}


basically what it does is has an element with a classname in this case 
.tooltip ... inside the element is has a hidden span containing html

div class=tooltipspan style=display:none;The HTML i want to 
display/spanThis is my tooltip Element ... Hover me to see the tip/div


The first couple of lines stop the event bubbliing to the html i put into it 
(just an image and a div in this case) .. you can see how its not bubbled up 
the DOM and its all pretty self explanitory .. you can see the mouse out 
function too (that removes the created tip when its lost its hover) ..


hope this helps a bit into understanding how things like this can be 
achieved


Regards
Alex








- Original Message - 
From: Calvin L cal...@gmail.com
To: Prototype  script.aculo.us prototype-scriptaculous@googlegroups.com
Sent: Wednesday, December 17, 2008 2:42 AM
Subject: [Proto-Scripty] Using Event.observe and checking for childNodes in 
a parent



 Hi everyone,

 I've been baffled on day on how to get this done. I'm fairly new to
 Javascript and Prototype, so excuse me if I sound stupid!

 I have an element, that, when hovered over, displays an absolutely
 positioned div. This div has a bunch of other elements inside it,
 because it displays a lot of information. I'm trying to use
 Event.observe to tell prototype when to close the popup div. I only
 want it to show when hovered over, and disappear when the mouse moves
 outside of the popup. Here's my code:

 Event.observe(window, 'mouseover', function(event){
 var elem = Event.element(event);
 if(elem.id != prodElem){
 $(prodElem).hide();
 event.stop();
 }
 });

 where prodElem is the id of popup div. The problem is, when I hover
 over the other elements inside prodElem, it will hide the popup. There
 are a zillion elements in there and I don't want to have to list out
 all the elements. Is there some way to check for all childNodes within
 a parent node?

 Thanks for any help!

 Calvin

 
 


--~--~-~--~~~---~--~~
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 Event.observe and checking for childNodes in a parent

2008-12-18 Thread Calvin Lai
Thanks Alex!
I'm going to give that a shot...and I see what you mean by seeing it in a
different way.

I'll let you know how it goes.

--
Calvin Lai
Business Development
http://dealspl.us


On Thu, Dec 18, 2008 at 1:27 AM, Alex Mcauley 
webmas...@thecarmarketplace.com wrote:


 I would look at the observe in a different way ...

 by that i mean observe the element that you are hovering not the whole
 window  this way the event will bubble up the DOM and can be stopped as
 bubbling goes up the document not down.. this is a quick and dirty tooltips
 script i wrote a few weeks ago which does the same thing you are trying to
 do

  tooltips : function() {
  $$(tooltipClass+' div').invoke('observe', 'mouseover', function(event)
 {event.stop();});
  $$(tooltipClass+' img').invoke('observe', 'mouseover', function(event)
 {event.stop();});
$$(tooltipClass).invoke('observe', 'mouseover', function(event) {
if($$(invokedTooltipClass).length = 1) {
 return;
}

var text=$(this).down(0).innerHTML;
if(text=='') {
 return;
}
   var width=(text.length*10)+'px';

   var x=Event.pointerX(event)-30;// horizontal (Left to Right)
   var y=Event.pointerY(event)+20; // vertical (Top to Bototm)

   var el = new Element('div', { 'class': 'tt','style' :

 'display:none;position:absolute;top:'+y+'px;left:'+x+'px;z-index:;max-width:300px;'
  }).update('div style=float:right;width:22px;margin-left:6px;img
 src=/resources/includes/images/help.png //div'+text);
   $(this).insert(el);
   Effect.Appear(el);
var att=this;
   Event.stop(event);

   $$(tooltipClass).invoke('observe', 'mouseout', function(event) {
$$('.tt').each(function(elem) {
  Effect.Fade(elem);
  $(elem).remove();
});
   });
  });
 }


 basically what it does is has an element with a classname in this case
 .tooltip ... inside the element is has a hidden span containing html

 div class=tooltipspan style=display:none;The HTML i want to
 display/spanThis is my tooltip Element ... Hover me to see the tip/div


 The first couple of lines stop the event bubbliing to the html i put into
 it
 (just an image and a div in this case) .. you can see how its not bubbled
 up
 the DOM and its all pretty self explanitory .. you can see the mouse out
 function too (that removes the created tip when its lost its hover) ..


 hope this helps a bit into understanding how things like this can be
 achieved


 Regards
 Alex








 - Original Message -
 From: Calvin L cal...@gmail.com
 To: Prototype  script.aculo.us 
 prototype-scriptaculous@googlegroups.com
 Sent: Wednesday, December 17, 2008 2:42 AM
 Subject: [Proto-Scripty] Using Event.observe and checking for childNodes in
 a parent


 
  Hi everyone,
 
  I've been baffled on day on how to get this done. I'm fairly new to
  Javascript and Prototype, so excuse me if I sound stupid!
 
  I have an element, that, when hovered over, displays an absolutely
  positioned div. This div has a bunch of other elements inside it,
  because it displays a lot of information. I'm trying to use
  Event.observe to tell prototype when to close the popup div. I only
  want it to show when hovered over, and disappear when the mouse moves
  outside of the popup. Here's my code:
 
  Event.observe(window, 'mouseover', function(event){
  var elem = Event.element(event);
  if(elem.id != prodElem){
  $(prodElem).hide();
  event.stop();
  }
  });
 
  where prodElem is the id of popup div. The problem is, when I hover
  over the other elements inside prodElem, it will hide the popup. There
  are a zillion elements in there and I don't want to have to list out
  all the elements. Is there some way to check for all childNodes within
  a parent node?
 
  Thanks for any help!
 
  Calvin
 
  
 


 


--~--~-~--~~~---~--~~
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 eval inside Ajax Request

2008-11-15 Thread kangax

On Nov 15, 10:26 pm, Namotco [EMAIL PROTECTED] wrote:
 I was trying to demonstrate my problem, it's not what's actually in my
 code.  It's seems that $('test') inside my eval is not the same as the
 $('test') outside of it.  When I try to run that code I'd expect $
 ('test')'s HTML to change, but it doesn't.  Why not and how can I make
 it do that?

Does something like this work?
eval('(function(el){ if (el = $(test)) { el.innerHTML = test } })
();');

--
kangax
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Prototype  script.aculo.us group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: using eval inside Ajax Request

2008-11-14 Thread kangax

On Nov 14, 7:03 pm, Namotco [EMAIL PROTECTED] wrote:
 Sorry, should be:

 eval(someVar=function() {     this.elm=$('outputs');    }; s=new
 someVar(); s.innerHTML='test';);

Omitting `var` is generally a bad idea. Either use `var` or assign to
a property directly (as in `window.foo = 'bar'`);

 alert($('outputs').innerHTML);

  // not 'test'

I'm not sure what this is supposed to do. You create an object (via
`new`) with `elm` property (referencing some element) and then assign
'test' to `innerHTML` property of that object. Why? : )

--
kangax
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Prototype  script.aculo.us group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: using eval inside Ajax Request

2008-11-12 Thread kangax

On Nov 12, 4:37 pm, Namotco [EMAIL PROTECTED] wrote:
 Maybe this evals, but the functions do not get exposed.  How should I
 be doing this?

 function reCalc() {
         var sendSymsN = new Ajax.Request(url, {method:'post', onSuccess:
 function() {
                                 var evalMe=decode(transport.responseText); // 
 returns
 ( fname = function() { doStuff; }
                                 eval(ev);
                                 }
                         }
 );

 }

Change server response from:

`fname = function(){ doStuff; }`

to:

`window.fname = function(){ doStuff; }`

--
kangax
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Prototype  script.aculo.us group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: Using Prototype from within an iframe

2008-11-06 Thread Walter Lee Davis


On Nov 6, 2008, at 3:57 PM, Walter Lee Davis wrote:
 [snip]

 The filesList reference works, and I know that the element is being
 extended, because the remove() part works correctly. But no matter
 what I try to insert into filesList later (I even tried with a simple
 lihowdy/li to see if multiple rows at a time was the issue) no
 insertion happens.

 Does anyone have any idea what might be happening here?

 Thanks in advance,



Well, I worked around the problem, probably a better way to go  
anyway. I made a new partial that could generate the entire list in  
one whack, and used Ajax.Updater to call it. I defined a function in  
the parent page called updateList(storyId) that wrapped A.U, and then  
called it from the iframe thusly:

top.window.updateList(?=$id?);

So now it works everywhere. I'd still like to know if there's any red  
hot reason why I couldn't do what I was trying under IE6. If anyone  
has any ideas, please let me know.

Thanks,

Walter

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Prototype  script.aculo.us group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: Using the Slider to trigger an onchange event

2008-10-20 Thread BreakingCurtis

Nevermind!

I found out that the issue is a bug with IE and the php framework that
is being used (Qcodo).  IE is calling Qcodo controls at the wrong time
when using a href=javascript  I just changed them all to a
href=# onclick=javascript... and it all works fine
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Prototype  script.aculo.us group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: Using a string as object name?

2008-10-13 Thread T.J. Crowder

Hi,

JavaScript provides the eval() function for this.  Google javascript
eval to find some references.

HTH,
--
T.J. Crowder
tj / crowder software / com

On Oct 13, 1:09 am, Charles [EMAIL PROTECTED] wrote:
 Is there any possible way with Prototype to parse the content of a
 string in reference to an object name.

 like objectname.getParam();

 is there any possible way?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Prototype  script.aculo.us group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: using onSuccess(transport, json) and header(Content-type: application/x-json)

2008-10-06 Thread jason maina

Try this:
//php
$myArray=array('status'=1);
$jsonData=json_encode($myArray);
return $jsonData;
Dont forget the header.

//javascript/prototype
jsonResponse=eval('('+response.responseText+')');
Access data as array:
var myVal=jsonResponse[0].status;

Hope that helps

On 10/7/08, liketofindoutwhy [EMAIL PROTECTED] wrote:

 For some reason, no matter what I use

   new Ajax.Request(url, {
   method: 'get',

   onSuccess: function(transport, json){
   //alert(Object.inspect(json));
   alert(json ? Object.inspect(json) : no JSON 
 object);
   },
...
 });

 and then in PHP, when i use

 header('Content-type: application/x-json');
 echo '{ status : 1 }';


 the ajax will come back showing  no JSON object

 it doesn't matter if i use   text/x-json  or text/json or application/
 json

 and it is prototype 1.6.0.3...
 is there something wrong the header or the formatting of the content?
 thanks.


 


-- 
Sent from Gmail for mobile | mobile.google.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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: using onSuccess(transport, json) and header(Content-type: application/x-json)

2008-10-06 Thread jason maina

Something I forgot json in your case will recieve the header while
transport the XHR object. So will have to evaluate transport  not
json

On 10/7/08, liketofindoutwhy [EMAIL PROTECTED] wrote:

 For some reason, no matter what I use

   new Ajax.Request(url, {
   method: 'get',

   onSuccess: function(transport, json){
   //alert(Object.inspect(json));
   alert(json ? Object.inspect(json) : no JSON 
 object);
   },
...
 });

 and then in PHP, when i use

 header('Content-type: application/x-json');
 echo '{ status : 1 }';


 the ajax will come back showing  no JSON object

 it doesn't matter if i use   text/x-json  or text/json or application/
 json

 and it is prototype 1.6.0.3...
 is there something wrong the header or the formatting of the content?
 thanks.


 


-- 
Sent from Gmail for mobile | mobile.google.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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: using onSuccess(transport, json) and header(Content-type: application/x-json)

2008-10-06 Thread T.J. Crowder

Hi,

You're looking for the JSON in the second parameter to onSuccess, but
that's the result of evaling the X-JSON *header*.  From
http://www.prototypejs.org/api/ajax/options:
...all callbacks (except onException) are invoked with two
parameters: the XMLHttpRequest object and the result of evaluating the
X-JSON response header, if any (can be null).

You're sending JSON back as the body of the response, not in an X-JSON
header.  If you do that, use transport.responseJSON in your onSuccess
handler:

onSuccess: function(transport){
alert(transport.responseJSON ?
Object.inspect(transport.responseJSON) : no JSON object);
},

Or if you really want to send an X-JSON header (where the body of the
response is something else), you'll have to modify your PHP to do
that.

HTH,
--
T.J. Crowder
tj / crowder software / com

On Oct 7, 2:54 am, liketofindoutwhy [EMAIL PROTECTED]
wrote:
 For some reason, no matter what I use

         new Ajax.Request(url, {
                         method: 'get',

                         onSuccess: function(transport, json){
                                 //alert(Object.inspect(json));
                                 alert(json ? Object.inspect(json) : no JSON 
 object);
                         },
                ...
         });

 and then in PHP, when i use

 header('Content-type: application/x-json');
 echo '{ status : 1 }';

 the ajax will come back showing  no JSON object

 it doesn't matter if i use   text/x-json  or text/json or application/
 json

 and it is prototype 1.6.0.3...
 is there something wrong the header or the formatting of the content?
 thanks.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Prototype  script.aculo.us group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: Using HTTPS

2008-09-23 Thread Walter Lee Davis

If the parent page is https, then any calls from within that page  
will be https, no extra effort needed. I did a site last year, demo'd  
it on regular http, moved it to https, made absolutely no changes to  
code and everything in the site (regular requests and Ajax) is in https.

Make sure that you always use relative URLs for all of your Ajax  
requests, and you get this for free.

As far as I know, you cannot use a non-secure page to request a  
secure script/Ajax fragment. That fails the same-origin test.

Walter

On Sep 23, 2008, at 10:07 AM, bob wrote:


 How can I use https calls with the prototype ?



--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Prototype  script.aculo.us group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: Using Ajax.Request not call function OnSuccess

2008-09-22 Thread Matt Foster

Your this scope is lost inside the this.exito method.  You need to
use a closure, via the bind method to ensure the instance's reference
is maintained in the asynchronous callbacks.

onSuccess : this.exito.bind(this)



On Sep 22, 10:14 am, Miguel Beltran R. [EMAIL PROTECTED] wrote:
 I don't know what do you meant but if I change

 onSuccess: this.exito,

 to

 onSuccess: function (transport){
 alert(3);
    var XML = transport.responseXML.documentElement;
    var response = XML.getElementsByTagName('respuesta')
 [0].childNodes[0].nodeValue;
    if (response == 'bien'){
       var accion = XML.getElementsByTagName('accion')
 [0].childNodes[0].nodeValue;
       if (accion=='alta'){
           this.exito_alta(XML);                    Here stop, no
 call the function
       }else if(accion=='modificar'){
           this.exito_modificar(XML);
       }else if(accion=='eliminar'){
           this.exito_eliminar(XML);
       }
    }else{
       var error_type = XML.getElementsByTagName('error_type')
 [0].childNodes[0].nodeValue;
       var error_description =
 XML.getElementsByTagName('error_description')
 [0].childNodes[0].nodeValue;
      // var content_error = ;
       str = 'strongPlaca:/strong' + $('bplac').value +
 'brstrongError tipo:/strong' + error_type +
            'brstrongDescripcion:/strong' + error_description;
       $('estado').update(str);
    }
  },

 })

 I added to my Class initialize but not work :(
 var Taller = Class.create({
   initialize: function() {
      this.exito.bind(this);
      this.exito_alta.bind(this);
   },

 2008/9/19 jason maina [EMAIL PROTECTED]:





  yourpadre,
  I stand to be corrected here, but most prototype methods/functions
  start with lower case eg onCreate, onFailure etc

  Do refer to prototype documentation for actual method/function names.

  Regards
  jason

  On 9/19/08, yourpadre [EMAIL PROTECTED] wrote:

  Hi List

  I try this
  1.- The submit form call mitaller.alta
  2.- Popup alert(1)
  3.- The data is corrected inserted in database
  4.- I expected this.exito run, but not
  5.- Popup alert(2)

  Why exito not run OnSuccess?
  If change it to: onSuccess: alert(popup) yes work fine.

  var Taller = Class.create({
    alta: function (event){
      event.stop();
  alert(1);
      new $('main_form').request({
                   parameters: $('main_form').serialize(),
                   onSuccess: this.exito,
                   onFailure: this.error
               });
  alert(2);
    },

    exito: function (transport){
  alert(3);
      var XML = transport.responseXML.documentElement;
      var response = XML.getElementsByTagName('respuesta')
  [0].childNodes[0].nodeValue;
      if (response == 'bien'){
         var accion = XML.getElementsByTagName('accion')
  [0].childNodes[0].nodeValue;
         if (accion=='alta'){
             exito_alta(XML);
         }else if(accion=='modificar'){
             exito_modificar(XML);
         }else if(accion=='eliminar'){
             exito_eliminar(XML);
         }
      }else{
         var error_type = XML.getElementsByTagName('error_type')
  [0].childNodes[0].nodeValue;
         var error_description =
  XML.getElementsByTagName('error_description')
  [0].childNodes[0].nodeValue;
        // var content_error = ;
         str = 'strongPlaca:/strong' + $('bplac').value +
  'brstrongError tipo:/strong' + error_type +
              'brstrongDescripcion:/strong' + error_description;
         $('estado').update(str);
      }
    },
  })

  var mitaller = new Taller();
  document.observe('dom:loaded', function(){
     $('main_form').observe('submit', mitaller.alta);
  });

  --
  Sent from Gmail for mobile | mobile.google.com

 --
 
 Lo bueno de vivir un dia mas
 es saber que nos queda un dia menos de vida
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Prototype  script.aculo.us group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: Using Prototype/Scriptaculous in a popup window

2008-09-20 Thread jason maina

In the parent page/window you could have an invisible div then use
ajax.request to update the div with desired data and seem to popup by
setting visibility=true

On 9/20/08, Bobby.D [EMAIL PROTECTED] wrote:

 Ok, I was just checking about the popup, I thought perhaps using the
 function to open would screw stuff up. I am designing an Intranet
 Business Web App, restricted to 1 browser. If I was going to use a
 lightbox effect I'd just open a whole new page, but I'm trying to
 give the app a slightly more desktop feel.

 On Sep 20, 1:49 pm, bluezehn [EMAIL PROTECTED] wrote:
 Can I please, please beg of you not to use a popup window. It's ugly.
 Most browsers just block them anyway so it's useless.

 You've got to remember as well that a popup window is a COMPLETELY
 separate browser instance. You can't access any variables at all from
 the source window, and prototype/scriptaculous will not be available
 unless they're included in the source of the popup.

 Much much better is to bring up a fixed positioned div floated above
 everything else on the page. Google prototip to see what I mean - and
 they don't have to be tooltips either, they can be full on windows
 over the rest of your page - see the other project by the author of
 prototip, think it's called lightbox, to see what I mean.

 Other than that advice, your question is way too vague to be able to
 answer it. If you have prototype in the source of the popup window,
 ajax will be available just as it otherwise would be - either you
 haven't included prototype or there's an error in your code, in which
 case the fact that it's running in a popup window is completely
 irrelevant.

 On Sep 20, 5:46 pm, Bobby.D [EMAIL PROTECTED] wrote:

  I'm using the following function to generate a pop up box:

  var win=null;
  function popUp(page, name, w, h, scrollb) {
  var winL = (screen.width-w)/2;
  var winT = (screen.height-h)/3.5;
  var settings = 'height='+h+',';
  settings += 'width='+w+',';
  settings += 'top='+winT+',';
  settings += 'left='+winL+',';
  settings += 'resizable=no';
  settings += 'scrollbars='+scrollb+',';
  settings += 'toolbar=no';
  settings += 'menubar=no';
  window.open(page, name, settings);

  }

  I use the following link to open:

  a href=# onclick=popUp('initiate.php', 'Initiate Case', '600',
  '600', 'no')img src=images/initiateCase.png alt=Initiate Case /

  /a

  The popup works, however, I can't get ANY AJAX to work on the pop up.
  I'm successfully loading several Spry Assets, I can't figure out why I
  can' get any of the AJAX to work.

  I'm using an Updater to display a dynamically generated number from a
  PHP page. When I pull the php page up, it is working properlybut
  no update.

  Could it be because of the way I'm opening the page?
 


-- 
Sent from Gmail for mobile | mobile.google.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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---