[Proto-Scripty] Scriptaculous onmouseover

2009-09-18 Thread Matt Johnson

So I'm creating a light-weight expanding and collapsing menu. I am
using the morph property to expand and contract the height of the list
items in the menu onmouseover. I am running into issues however where
(once I've expanded the list) every time I rollover an item within the
expanded list item, it re-triggers the morph effect.

Basically I'm just wondering if there is a quick and easy way for
scriptaculous effects to work well onmouseover and onmouseout. 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: Scriptaculous onmouseover

2009-09-18 Thread T.J. Crowder

Hi,

 Basically I'm just wondering if there is a quick and easy way for
 scriptaculous effects to work well onmouseover and onmouseout. Thanks!

script.aculo.us is working fine with the events, it's just that the
events aren't doing what you expect them to do.  Read up on mouseover
and mouseout and you'll understand why; in particular, mouseout fires
whenever the mouse leaves any element *within* the element you're
watching it on (because it bubbles).

Prototype 1.6.1 adds support for the mouseenter and mouseleave events
to all browsers (IE has had them forever) which are probably more
appropriate to what you want.

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


On Sep 18, 7:05 am, Matt Johnson mobyjohn...@gmail.com wrote:
 So I'm creating a light-weight expanding and collapsing menu. I am
 using the morph property to expand and contract the height of the list
 items in the menu onmouseover. I am running into issues however where
 (once I've expanded the list) every time I rollover an item within the
 expanded list item, it re-triggers the morph effect.

 Basically I'm just wondering if there is a quick and easy way for
 scriptaculous effects to work well onmouseover and onmouseout. 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: Events not working as expected in opera, ie or any other browser except firefox

2009-09-18 Thread david

Hi Juan,

IE has much trouble with table. So not surprinsing that IE doesn't
work as expected.

--
david

On 17 sep, 19:10, Juan Diego juandieg...@gmail.com wrote:
 Thanks.
 One more thing, I am doing this inside a joomla so those divs are
 inside a table inside thecontent module of joomla.  When ever I use
 alert(e2) I thought i was getting the table, because it said something
 about table element, so for some reason in internet explorer it goes
 directly to the body.  That is what it is happening right?  I am going
 to try with teh up() function.

 Ken I am using [2] because there is some text with p/p that i
 though it wasnt important.  But thanks for noticing.

 Juan

 On Sep 17, 6:08 am, david david.brill...@gmail.com wrote:

  Hi Kev,

  the getOffSetParent() return the closest positioned ancestor, and if
  not found return the body !
  That's why for some element, parent is not positionned (CSS position
  property) and it return the body element.

  As you say, up() is much more appropriate in this case.

  --
  david

  On 17 sep, 10:38, Kevin Porter k...@9ballpool.co.uk wrote:

   Hi Juan,

   For me, I get the error at e2.childElements()[2].setStyle
   e2 at that point is the body element. Is that what you want?
   I guess you want the LI element? If so, maybe .up() would be a better
   choice than .getOffSetParent()?
   Also, you probably want to use [1] instead of [2] to reference the
   second element of the LI. (it's
   a zero-indexed array).

   regards,

   - Kev

   Juan Diego wrote:
Ok, so I cleaned up my code.  I used each instead of a For loop, so
now it works in every Browser except IE8. I havent tested it in other
versions of IE. Like 6 o 7.
So here is the code.

function listas(){
   $$('div.texto').each(function(s) { Event.observe(s, 'mouseover',
reemplazarX)});
   $$('div.texto').each(function(s) { Event.observe(s, 'mouseout',
borrar)});
};

function reemplazarX(){
   var element = this;
   var e2 =element.getOffsetParent();
   alert(e2);
   e2.childElements()[2].setStyle({
           backgroundColor: '#020506',
           opacity: 1.0,
           borderLeft:'1px #FFF solid'
   });
   e2.childElements()[2].innerHTML= element.next().innerHTML;

}
function borrar(){
   var element = this;
   var e2 =element.getOffsetParent();
   e2.childElements()[2].innerHTML= ;
   e2.childElements()[2].setStyle({
           backgroundColor: '#000',
           opacity: 0.0
   });
}

I get an error on Line 14.  The object does not accept this property
or method So the problem seems to be in this line var e2
=element.getOffsetParent();
With getOffsetParent function.

This code works in opera, konqueror, safari, firefox.

Thanks

On Sep 17, 12:36 am, Juan Diego juandieg...@gmail.com wrote:

By the way i just found out that
var lista_izq=$$('div.lista_izq')[i].childElements()[0].childElements
();
is the problem in IE explorer. In opera works but in IE8 is a problem

On Sep 17, 12:19 am, Juan Diego juandieg...@gmail.com wrote:

Hi I havent use javascript and prototype in a while so maybe i am
doing something really wrong.
So here is what I am trying to do with prototype
I have a a few places in my page with a set of to divs divs, lista_izq
and lista_der, with a list inside list_izq
div class=lista_izq
ul
    lidiv class=texttext1/div
          div class=hidden_texthidden1/div
    /li
   lidiv class=texttext2/div
          div class=hidden_texthidden2/div
    /li
/ul
/div
div class=lista_dernbsp/div

So when ever the mouse is over the text1 or text2. The hidden text
appears on the second .
I use firefox so I did all the testing there. It worked but when i
tested on opera, IE, and konqueror it didnt. It is really anoying
tracing bugs in other browsers without firebug.  Anyhow here is my
code for each node

        Event.observe(titulo, 'mouseover', function(e) {
                reemplazarX(e);
        });
        Event.observe(titulo, 'mouseout', function(e) {
                borrar(e);
        });

and this my functions

function reemplazarX(e){
        alert(e);
        alert(e.element);
        alert(e.element());
        var element = e.element();
        alert(s);
        var e2 =element.getOffsetParent(element);
        alert(t);
//e2.childElements()[2].setStyle('backgroundColor', blue);

        alert(element);
        alert(xx);
        e2.childElements()[2].setStyle({
                backgroundColor: '#020506',
                opacity: 1.0,
                borderLeft:'1px #FFF solid'
        });
        e2.childElements()[2].innerHTML= element.next().innerHTML;

}

function borrar(e,lista_der){
        var element = e.element();
  

[Proto-Scripty] Re: IE8 responseXML ?

2009-09-18 Thread david

Hi Jason,

  the way you write it is good even in IE.
  When write  onComplete: parent_response() , you launch the function
  at initialisation time, and the AJAX was not call, so you input is
  undefined. If you test alert(originalRequest) you should also have
  undefined.

 When should this be launched, then?  I thought onComplete called the
 callback function after the entire ajax call had completed, regardless
 of success/failure ?

In fact by writting parent_response(), it indicate that you execute
the function on the creation of the AJAX request, and the retruned of
the execution of the function value will be used for the onComplete.
So the onComplete value will be uindefined (as you return nothing in
the function).
By setting parent_response, you copy the function definition to the
onComplete parameter.
This is the big difference.


  For your trouble, what is the response text of the AJAX request ??
  you should check it too, in case xML was not recognize by IE and set
  as text.

 It definitely returns XML ..  It's something like this :

 Departments
   ou name='foo' value='bar' /
   ou name='baz' value='qux' /
 /Departments


The originalRequest in your parent_response function is in fact an
response Object, go and see the API doc at
http://prototypejs.org/api/ajax/response
If the originalRequest.text value inside the function is your XML
document, it should be a problem in header not recognize by IE.
in that case, you should create an XML document by yourself with the
returned text or modify header.

One thougth, is it a well formed XML, beginning with xml ... asthe
root tag ? it could also be a reason.

To know what contain originalRequest just paste on this thread the
retruned value of:
$H(originalRequest).inspect(). We will have all info on that object.

--
david


On 17 sep, 16:56, Jason Frisvold xenopha...@gmail.com wrote:
 On 09/17/2009 07:14 AM, david wrote:



  Hi Jason,

  the way you write it is good even in IE.
  When write  onComplete: parent_response() , you launch the function
  at initialisation time, and the AJAX was not call, so you input is
  undefined. If you test alert(originalRequest) you should also have
  undefined.

 When should this be launched, then?  I thought onComplete called the
 callback function after the entire ajax call had completed, regardless
 of success/failure ?

  For your trouble, what is the response text of the AJAX request ??
  you should check it too, in case xML was not recognize by IE and set
  as text.

 It definitely returns XML ..  It's something like this :

 Departments
   ou name='foo' value='bar' /
   ou name='baz' value='qux' /
 /Departments

 The parent_response function will parse that, create what I need, and
 display it.  The problem is, originalRequest doesn't seem to get set, or
 if it does, it's not by what I'm expecting.

 Should I call the AJAX some other way instead of via the body onload?



  --
  david

  On 16 sep, 23:26, Jason Frisvold xenopha...@gmail.com wrote:
  Hi,

          I'm running into a problem with IE8 and responseXML.  Code follows 
  :

  var url = 'http://example.com/myfile.php';

  function update_parent() {
      var root = 1;
      var myAjax = new Ajax.Request(url,
                       {
                          method: 'get',
                          parameters: {parent_id: root},
                          onComplete: parent_response
                       }
                                    );

  }

  // ---

  function parent_response(originalRequest) {
      var domObj = originalRequest.responseXML;
      alert(domObj);

  }

  This is all fired off via a body onload='update_parent'

  This works perfectly in Firefox.  However, in IE8, it is failing with no
  errors.  The alert in parent_response() does not get triggered in IE8.

  If I change the onComplete: to read :

  onComplete: parent_response()

  Then the alert triggers, but it pops up as undefined.  How do I properly
  handle this so it works cross-browser?  ie, what object should I be
  sending to get to the responseXML value?

  Thanks,

  --
  ---
  Jason Frisvold
  xenopha...@gmail.com
  ---
  I love deadlines. I like the whooshing sound they make as they fly by.
     - Douglas Adams

 --
 ---
 Jason Frisvold
 xenopha...@gmail.com
 ---
 I love deadlines. I like the whooshing sound they make as they fly by.
    - Douglas Adams
--~--~-~--~~~---~--~~
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: Resuming a stopped PeriodicalExecuter

2009-09-18 Thread david

Hi jojo,

In the code, the start() function does the oposite of the stop()
function, I think that function could be used.
But effectivelly, it's not in the doc.

So you could restart it with start, or recreate a new one.

--
david

On 18 sep, 09:42, JoJo tokyot...@gmail.com wrote:
 Hi David,

 I know PeriodicalUpdater has a start() function, but
 PeriodicalExecuter does not (according to the documentation).

 On Sep 16, 5:27 am, david david.brill...@gmail.com wrote:

  Hi Jojo,

  if you look at prototype source, you will see that there is a start
  function on the PeriodicalUpadter

  --
  david

  On 15 sep, 02:04, JoJo tokyot...@gmail.com wrote:

  http://www.prototypejs.org/api/periodicalExecuter

   I noticed that there is no start method of a PeriodicalExecuter.
   However, AJAX.PeriodicalUpdater does have one.  I'm trying to mix
   these two types and polymorphically start and stop them.  To restart a
   PE, do I really have to redeclare 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-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] .select on a combo

2009-09-18 Thread speedpac...@gmail.com

Hello,

I'm trying my secod post here - I never got my first to end up on the
list, so l'ts try it through the google groups website directly now...

I'm having an issue that I hope someone here can help me with...

I have the following code:

HTML:
--
select id=orderOption[hjkhhjh.ch] domain=hjkhhjh.ch
name=orderOption[hjkhhjh.ch]
option value=N15 domain=hjkhhjh.ch prepaid_total=18.50 EUR
postpaid_total=23.15 EURRegistreer voor 1 Jaar/option
option value=N16 domain=hjkhhjh.ch prepaid_total=36.30 EUR
postpaid_total=45.40 EURRegistreer voor 2 Jaar/option
option value=N19 domain=hjkhhjh.ch prepaid_total=53.40 EUR
postpaid_total=66.60 EURRegistreer voor 3 Jaar/option
option value=N17 domain=hjkhhjh.ch prepaid_total=87.00 EUR
postpaid_total=109.00 EURRegistreer voor 5 Jaar/option
option value=N18 domain=hjkhhjh.ch prepaid_total=170.50 EUR
postpaid_total=213.50 EURRegistreer voor 10 Jaar/option
/select

What I'm trying to do is when a user selects an option from the list,
the prepaid_total and postpaid_total price should show on a different
div...

this is the javascript that worked up until a few weeks ago when I
upgraded to the new release of prototype:
JAVASCRIPT:


orderOptions.observe('change', function(event) {
alert('clicked for ' + orderOptions.getAttribute
('domain'));
rec = $('domainSearchResult').select('[domain=' +
orderOptions.getAttribute('domain') + ']');
tdPrepaid = rec[0].select('[f=prepaid]');
tdPostpaid = rec[0].select('[f=postpaid]');

alert(orderOptions.getValue());
selectedItem = orderOptions.select('[value=' +
orderOptions.getValue() + ']');
alert(selectedItem);
tdPrepaid[0].update(selectedItem[0].getAttribute
('prepaid_total'));
tdPostpaid[0].update(selectedItem[0].getAttribute
('postpaid_total'));
});

The two first alerts give me what I expect, the third one just returns
NOTHING...  I used to be able to select the options with the value
like that, but it seems to be no longer working...

Any idea?

Also - I know adding attributes to the elements like that is not the
way to go - I just don't know how I can do this otherwise :(

--~--~-~--~~~---~--~~
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: .select on a combo

2009-09-18 Thread speedpac...@gmail.com

Hi,

First and foremost - thanks for the feedback!  It's MUCH appreciated!
To test, you can go to www.flexin.be

Once arrived on that site, log in using t...@speedpacket.com / test123
(top right)

Then go to 
http://flexin.be/site/en/ProductSubscriptionDomain/addToCart/index.html
(it will return an error if you are not logged in yet)

Next, search for a domain name; if it is available, it will result in
a row in the table which gives you some order options; change the
order option to two years for instance - that is where we run into
this issue...

There may still be some debugging code on the page, but it should give
you an idea as to what we want to achieve (the prices shown should
reflect that for the period selected...)


Thanks again for the feedback!  Very much appreciated!

David.

On Sep 18, 5:59 pm, david david.brill...@gmail.com wrote:
 Hi speedpacket,

  this is the javascript that worked up until a few weeks ago when I
  upgraded to the new release of prototype:

 I've tested with with prototype v1.6.0.2 and 1.6.1 and both does not
 return anything.
 But I'm not sure, because I have to modify the code you give.
 Please, send us a link, or a whole code, we'll have to test and guess
 how to set variables like  orderOptions, domainSearchResult, ...

  Also - I know adding attributes to the elements like that is not the
  way to go - I just don't know how I can do this otherwise :(

 There is the new Element.store which is done for that. give it a try.
 see:http://api.prototypejs.org/dom/element.html#store-class_method
 It could save a lot depending to what you want do.

 --
 david

 On 18 sep, 14:17, speedpac...@gmail.com speedpac...@gmail.com
 wrote:

  Hello,

  I'm trying my secod post here - I never got my first to end up on the
  list, so l'ts try it through the google groups website directly now...

  I'm having an issue that I hope someone here can help me with...

  I have the following code:

  HTML:
  --
  select id=orderOption[hjkhhjh.ch] domain=hjkhhjh.ch
  name=orderOption[hjkhhjh.ch]
  option value=N15 domain=hjkhhjh.ch prepaid_total=18.50 EUR
  postpaid_total=23.15 EURRegistreer voor 1 Jaar/option
  option value=N16 domain=hjkhhjh.ch prepaid_total=36.30 EUR
  postpaid_total=45.40 EURRegistreer voor 2 Jaar/option
  option value=N19 domain=hjkhhjh.ch prepaid_total=53.40 EUR
  postpaid_total=66.60 EURRegistreer voor 3 Jaar/option
  option value=N17 domain=hjkhhjh.ch prepaid_total=87.00 EUR
  postpaid_total=109.00 EURRegistreer voor 5 Jaar/option
  option value=N18 domain=hjkhhjh.ch prepaid_total=170.50 EUR
  postpaid_total=213.50 EURRegistreer voor 10 Jaar/option
  /select

  What I'm trying to do is when a user selects an option from the list,
  the prepaid_total and postpaid_total price should show on a different
  div...

  this is the javascript that worked up until a few weeks ago when I
  upgraded to the new release of prototype:
  JAVASCRIPT:
  

              orderOptions.observe('change', function(event) {
                  alert('clicked for ' + orderOptions.getAttribute
  ('domain'));
                  rec = $('domainSearchResult').select('[domain=' +
  orderOptions.getAttribute('domain') + ']');
                  tdPrepaid = rec[0].select('[f=prepaid]');
                  tdPostpaid = rec[0].select('[f=postpaid]');

                  alert(orderOptions.getValue());
                  selectedItem = orderOptions.select('[value=' +
  orderOptions.getValue() + ']');
                  alert(selectedItem);
                  tdPrepaid[0].update(selectedItem[0].getAttribute
  ('prepaid_total'));
                  tdPostpaid[0].update(selectedItem[0].getAttribute
  ('postpaid_total'));
              });

  The two first alerts give me what I expect, the third one just returns
  NOTHING...  I used to be able to select the options with the value
  like that, but it seems to be no longer working...

  Any idea?

  Also - I know adding attributes to the elements like that is not the
  way to go - I just don't know how I can do this otherwise :(
--~--~-~--~~~---~--~~
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: .select on a combo

2009-09-18 Thread Marko

Hi,

Instead of adding attributes on element you can rewrite it like this:

option value=N15 domain=hjkhhjh.ch prepaid_total=18.50 EUR
postpaid_total=23.15 EURRegistreer voor 1 Jaar/option

= 

option value=code|domain|pre_total|post_totalRegistreer voor 1 Jaar/option

= 

option value=N15|hjkhhjh.ch|18.50 EUR|23.15 EURRegistreer voor 1 
Jaar/option
 

You can get value like this:

selectedItem = orderOptions.select('[value=' +
orderOptions.getValue() + ']');

=
As this is  equal to  orderOptions you can do:

selectedItem = $F(this)



Then you can split it and get array:

selectedItem.split(|)



You can also rewrite your selects like this:

Instead of: td f=prepaid
write just: td class=prepaid

tdPrepaid = rec[0].select('[f=prepaid]');
= 
tdPrepaid = rec[0].select('.prepaid');



This way you will preserve valid HTML

I think you get idea how to rewrite it.

- Marko



speedpac...@gmail.com wrote:
 Hello,

 I'm trying my secod post here - I never got my first to end up on the
 list, so l'ts try it through the google groups website directly now...

 I'm having an issue that I hope someone here can help me with...

 I have the following code:

 HTML:
 --
 select id=orderOption[hjkhhjh.ch] domain=hjkhhjh.ch
 name=orderOption[hjkhhjh.ch]
 option value=N15 domain=hjkhhjh.ch prepaid_total=18.50 EUR
 postpaid_total=23.15 EURRegistreer voor 1 Jaar/option
 option value=N16 domain=hjkhhjh.ch prepaid_total=36.30 EUR
 postpaid_total=45.40 EURRegistreer voor 2 Jaar/option
 option value=N19 domain=hjkhhjh.ch prepaid_total=53.40 EUR
 postpaid_total=66.60 EURRegistreer voor 3 Jaar/option
 option value=N17 domain=hjkhhjh.ch prepaid_total=87.00 EUR
 postpaid_total=109.00 EURRegistreer voor 5 Jaar/option
 option value=N18 domain=hjkhhjh.ch prepaid_total=170.50 EUR
 postpaid_total=213.50 EURRegistreer voor 10 Jaar/option
 /select

 What I'm trying to do is when a user selects an option from the list,
 the prepaid_total and postpaid_total price should show on a different
 div...

 this is the javascript that worked up until a few weeks ago when I
 upgraded to the new release of prototype:
 JAVASCRIPT:
 

 orderOptions.observe('change', function(event) {
 alert('clicked for ' + orderOptions.getAttribute
 ('domain'));
 rec = $('domainSearchResult').select('[domain=' +
 orderOptions.getAttribute('domain') + ']');
 tdPrepaid = rec[0].select('[f=prepaid]');
 tdPostpaid = rec[0].select('[f=postpaid]');

 alert(orderOptions.getValue());
 selectedItem = orderOptions.select('[value=' +
 orderOptions.getValue() + ']');
 alert(selectedItem);
 tdPrepaid[0].update(selectedItem[0].getAttribute
 ('prepaid_total'));
 tdPostpaid[0].update(selectedItem[0].getAttribute
 ('postpaid_total'));
 });

 The two first alerts give me what I expect, the third one just returns
 NOTHING...  I used to be able to select the options with the value
 like that, but it seems to be no longer working...

 Any idea?

 Also - I know adding attributes to the elements like that is not the
 way to go - I just don't know how I can do this otherwise :(

 
   


--~--~-~--~~~---~--~~
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: .select on a combo

2009-09-18 Thread speedpac...@gmail.com

Hi Marko,

Great idea on combining the different attributes into one value
attribute with the pipe character.  I'll consider it for a later
version, because this obviously also requires changes on the
serverside as we'll end up with other values being sent to the
server...

The class tihngy I knew and was on my todo list to change to that...

Unfortunately it doesn't fix my issue at this time (unless I'm
misinterpreting what you are saying...)
Have you gotten a chance to look into that biyt of code not giving me
the result I believed I should have received (and did before I
upgraded...)

Thanks again for the feedback - I really do appreciate it!

David.

On Sep 18, 7:01 pm, Marko gm.ma...@gmail.com wrote:
 Hi,

 Instead of adding attributes on element you can rewrite it like this:

 option value=N15 domain=hjkhhjh.ch prepaid_total=18.50 EUR
 postpaid_total=23.15 EURRegistreer voor 1 Jaar/option

 =

 option value=code|domain|pre_total|post_totalRegistreer voor 1 
 Jaar/option

 =

 option value=N15|hjkhhjh.ch|18.50 EUR|23.15 EURRegistreer voor 1 
 Jaar/option

 You can get value like this:

 selectedItem = orderOptions.select('[value=' +
 orderOptions.getValue() + ']');

 =
 As this is  equal to  orderOptions you can do:

 selectedItem = $F(this)

 Then you can split it and get array:

 selectedItem.split(|)

 You can also rewrite your selects like this:

 Instead of: td f=prepaid
 write just: td class=prepaid

 tdPrepaid = rec[0].select('[f=prepaid]');
 =
 tdPrepaid = rec[0].select('.prepaid');

 This way you will preserve valid HTML

 I think you get idea how to rewrite it.

 - Marko

 speedpac...@gmail.com wrote:
  Hello,

  I'm trying my secod post here - I never got my first to end up on the
  list, so l'ts try it through the google groups website directly now...

  I'm having an issue that I hope someone here can help me with...

  I have the following code:

  HTML:
  --
  select id=orderOption[hjkhhjh.ch] domain=hjkhhjh.ch
  name=orderOption[hjkhhjh.ch]
  option value=N15 domain=hjkhhjh.ch prepaid_total=18.50 EUR
  postpaid_total=23.15 EURRegistreer voor 1 Jaar/option
  option value=N16 domain=hjkhhjh.ch prepaid_total=36.30 EUR
  postpaid_total=45.40 EURRegistreer voor 2 Jaar/option
  option value=N19 domain=hjkhhjh.ch prepaid_total=53.40 EUR
  postpaid_total=66.60 EURRegistreer voor 3 Jaar/option
  option value=N17 domain=hjkhhjh.ch prepaid_total=87.00 EUR
  postpaid_total=109.00 EURRegistreer voor 5 Jaar/option
  option value=N18 domain=hjkhhjh.ch prepaid_total=170.50 EUR
  postpaid_total=213.50 EURRegistreer voor 10 Jaar/option
  /select

  What I'm trying to do is when a user selects an option from the list,
  the prepaid_total and postpaid_total price should show on a different
  div...

  this is the javascript that worked up until a few weeks ago when I
  upgraded to the new release of prototype:
  JAVASCRIPT:
  

              orderOptions.observe('change', function(event) {
                  alert('clicked for ' + orderOptions.getAttribute
  ('domain'));
                  rec = $('domainSearchResult').select('[domain=' +
  orderOptions.getAttribute('domain') + ']');
                  tdPrepaid = rec[0].select('[f=prepaid]');
                  tdPostpaid = rec[0].select('[f=postpaid]');

                  alert(orderOptions.getValue());
                  selectedItem = orderOptions.select('[value=' +
  orderOptions.getValue() + ']');
                  alert(selectedItem);
                  tdPrepaid[0].update(selectedItem[0].getAttribute
  ('prepaid_total'));
                  tdPostpaid[0].update(selectedItem[0].getAttribute
  ('postpaid_total'));
              });

  The two first alerts give me what I expect, the third one just returns
  NOTHING...  I used to be able to select the options with the value
  like that, but it seems to be no longer working...

  Any idea?

  Also - I know adding attributes to the elements like that is not the
  way to go - I just don't know how I can do this otherwise :(
--~--~-~--~~~---~--~~
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: including prototype dynamically, and observe:domloaded

2009-09-18 Thread Ngan Pham
Hi jrochkind,
I believe document.write is execute properly and full before your observe
call is done.  However, document.write's job is simply to write the string
to the browser, nothing more.  It's then the browser's job to interpret the
string and do whatever it has to do on a different tangent. In this case,
load an external javascript document.  So immediately after document.write
has performed it's job, the next statement is ran--which causes the problem
for you since the external prototype script is not ready.

As stated above this isn't a good thing to do in general.  However, to
answer your questionyou either of the follow (there may be more
options):
1. Modify the prototype.js file and add a function call at the bottom to let
your page know prototype is loaded.
2. Use a setInterval function to periodically check for prototype's
existence.  Once it's available you can then stop the checking and resume
your code.

On Thu, Sep 17, 2009 at 12:37 PM, Jonathan Rochkind rochk...@jhu.eduwrote:


 Thanks Alex, I think that post does have the right analysis of what
 was going on in my case and why it wasn't working.

 And thanks for the alert that loading prototype via document.write in
 general may be a bad idea.

 Is there any good way to have an external .js file trigger a load of
 Prototype, or is this basically just a lost cause, and if you want
 Prototype on a page, you've just got to include a script tag that
 references a prototype.js file directly on the page, no ifs and or
 buts?

 Jonathan

 On Sep 17, 3:23 pm, Alexander Wallace alexmlwall...@gmail.com wrote:
  While I don't recommend loading prototype via document.write,
  this might be due to including both the doc.write(prototype) and the
  doc.observe() function within the same enclosing script tag.
  See:
 http://kossovsky.net/index.php/2009/07/script-as-blocking-element-and...
 
  But I really don't recommend loading prototype.js using document.write.
  I'm not sure how that would interfere with the IE method of dom:loaded
  (which involves using document.writing a deferred script element and
  watching its .onreadystatechange), but I can't imagine the outcome
  would be bug-free.
 
  -Alex
 
  On Thu, Sep 17, 2009 at 2:54 PM, jrochkind rochk...@jhu.edu wrote:
 
   So theoretically (Prototype 1.6), it should be possible to have
   javascript code include the Prototype library into a page via
   document.write, right?
 
   document.write('script type=text/javascript src='http://somewhere/
   edu/is//prototype.js\/script');
 
   Okay, this mostly works. Unless you want the same script that did this
   to then immediately call any Prototype function, such as
   document.observe.
 
   document.write('script type=text/javascript src='http://somewhere/
   edu/is//prototype.js\/script');
   document.observe(dom:loaded, function() { alert('loaded!'); });
 
   This does NOT work, because at the point that document.observe is up
   there, Prototype is NOT actually loaded yet.  Although it will be
   eventually.
 
   Can anyone explain what's going on?  Does the browser not do or fully
   process the document.write until after the current script is fully
   done?
 
   Is there any way to have a script include the prototype library
   dynamically, and then have that same script call some prototype
   functions, such as in particular document.observe?
 


--~--~-~--~~~---~--~~
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: Status of script.aculo.us

2009-09-18 Thread Mike Kelly

On Sep 17, 3:29 pm, Jarkko Laine jarks...@gmail.com wrote:
 Have you seen http://scripty2.com/ ?

Now I have. :p

The big This is alpha software warning will keep me from using it in
production for now, but I may play around with it a bit on my own.

Also, its main page is almost painfully slow in my browser (Firefox
3.5 on FreeBSD)... But, yeah, alpha, so I don't expect too much
optimization just yet.

But, thanks for the pointer.

--
Mike Kelly
--~--~-~--~~~---~--~~
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: IE8 responseXML ?

2009-09-18 Thread Jason Frisvold

On 09/18/2009 06:43 AM, david wrote:
 Hi Jason,
 
 In fact by writting parent_response(), it indicate that you execute
 the function on the creation of the AJAX request, and the retruned of
 the execution of the function value will be used for the onComplete.
 So the onComplete value will be uindefined (as you return nothing in
 the function).
 By setting parent_response, you copy the function definition to the
 onComplete parameter.
 This is the big difference.

Yes, that is a massive difference ...  Thanks for the explanation !

 The originalRequest in your parent_response function is in fact an
 response Object, go and see the API doc at
 http://prototypejs.org/api/ajax/response
 If the originalRequest.text value inside the function is your XML
 document, it should be a problem in header not recognize by IE.
 in that case, you should create an XML document by yourself with the
 returned text or modify header.

The exact output of the program being called is follows :

?xml version=1.0 encoding=ISO-8859-1?
departments
  ou value='1' name='Academics' /
  ou value='2' name='Admissions' /
/departments

I *think* this is valid, though it is missing a doctype header.  It's a
php script outputting this which we've written to send a header of:

Content-type: application/xml

 One thougth, is it a well formed XML, beginning with xml ... asthe
 root tag ? it could also be a reason.

I believe it's well-formed, at least to my knowledge..

 To know what contain originalRequest just paste on this thread the
 retruned value of:
 $H(originalRequest).inspect(). We will have all info on that object.

via IE8?  It returns nothing.  I tried adding:

alert($H(originalRequest).inspect()); to the parent_response method and
the alert never shows up when running via IE8.

 --
 david


-- 
---
Jason Frisvold
xenopha...@gmail.com
---
I love deadlines. I like the whooshing sound they make as they fly by.
   - Douglas Adams

--~--~-~--~~~---~--~~
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: IE8 responseXML ?

2009-09-18 Thread Jason Frisvold

On 09/18/2009 03:00 PM, Jason Frisvold wrote:
 via IE8?  It returns nothing.  I tried adding:
 
 alert($H(originalRequest).inspect()); to the parent_response method and
 the alert never shows up when running via IE8.

I have discovered more..  Adding an onException block like this :

function update_parent() {
/** retrieve XML */
var root = 1;
var myAjax = new Ajax.Request(url,
 {
method: 'get',
parameters: {parent_id: root},
onSuccess: function(response) {
alert('SUCCESS: ' + response.responseText);
},
onFailure: function(response) {
alert('FAILURE: ' + response);
},
onException: function(request,error) {
alert('EXCEPTION: ' + error.message);
},
onComplete: function(response) {
alert('COMPLETE: ' + error.message);
}
 }
  );
}

ends up with IE8 popping up an EXCEPTION: Access is denied. message..
Access to what, though?

 --
 david


-- 
---
Jason Frisvold
xenopha...@gmail.com
---
I love deadlines. I like the whooshing sound they make as they fly by.
   - Douglas Adams

--~--~-~--~~~---~--~~
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: IE8 responseXML ?

2009-09-18 Thread Jason Frisvold

AHA!!!

I have resolved this.

We had a base element in the head of the document.  Apparently this is
to reference where the images/css/etc are.  This causes IE8 to prevent
javascript from retrieving a page due to security restrictions.

I'd feel dumb about it if I didn't think this was a really poor way to
secure javascript.  Why they can't compare the destination domain of the
request to the domain of the original HTML, I don't know.  Either way, I
have both resolved the problem and learned a bunch about
prototype/javascript in the process.

Thanks a lot, david, I really appreciate the help!

-- 
---
Jason Frisvold
xenopha...@gmail.com
---
I love deadlines. I like the whooshing sound they make as they fly by.
   - Douglas Adams

--~--~-~--~~~---~--~~
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] A better way to check for an element.

2009-09-18 Thread Luisgo

Hey all,

I was wondering if you can suggest a better way of achieving what this
snippet does. I do it often enough that it starts bloating my code and
frankly just gets annoying to type.

   var some_button = $('some-button')
   if ( some_button ) {
 some_button.observe(click,function(event){
   event.stop();
   form_object.save();
 });
   }

I can compress it a bit by doing this:

   if ( some_button = $('some-button') ) {
 some_button.observe(click,function(event){
   event.stop();
   form_object.save();
 });
   }

But that's little consolation.

In an ideal world I would want to do something close to:

   $('some-button').observe(click,function(){
 form_object.save();
   }, false );

Note: that false parameter would replace event.stop() which happens
often enough. Defaults to true.

Or even like (I know it looks like JQuery):

   $('some-button').click(function(){
 form_object.save();
   },false);

Any ideas/suggestions?

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: A better way to check for an element.

2009-09-18 Thread Rick Waldron
Its not much different, but this is what i do:

if ( $('some_button') ) {
  $('some_button').observe('click', function (e) {
//do stuff.
  });
}


Ideally, i wish prototype was a bit more strict about this stuff...

If you're using Firebug, you could replace your $() definition:

function $(element) {
  if (arguments.length  1) {
for (var i = 0, elements = [], length = arguments.length; i  length;
i++)
  elements.push($(arguments[i]));
return elements;
  }
*  if (Object.isString(element)) {
var _element  = element;
element  = document.getElementById(element);

if ( element == null ) {
  console.log('' + _element + ' is null or does not exist');
  return;
}
  }
*  return Element.extend(element);
}







On Fri, Sep 18, 2009 at 4:17 PM, Luisgo lgo...@gmail.com wrote:


 Hey all,

 I was wondering if you can suggest a better way of achieving what this
 snippet does. I do it often enough that it starts bloating my code and
 frankly just gets annoying to type.

   var some_button = $('some-button')
   if ( some_button ) {
 some_button.observe(click,function(event){
   event.stop();
   form_object.save();
 });
   }

 I can compress it a bit by doing this:

   if ( some_button = $('some-button') ) {
 some_button.observe(click,function(event){
   event.stop();
   form_object.save();
 });
   }

 But that's little consolation.

 In an ideal world I would want to do something close to:

   $('some-button').observe(click,function(){
 form_object.save();
   }, false );

 Note: that false parameter would replace event.stop() which happens
 often enough. Defaults to true.

 Or even like (I know it looks like JQuery):

   $('some-button').click(function(){
 form_object.save();
   },false);

 Any ideas/suggestions?

 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] Slightly off topic about CSS

2009-09-18 Thread Russell Keith
I have the following CSS class I am adding with Element.addClassName 

 

tr.selected{

background: url(/images/ArrowSelection.gif) no-repeat;

background-color: #AA;

}

 

My issue is that it is also adding the background image to each td in
the tr.  Any idea how to stop this?


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