[Proto-Scripty] Re: Rerouting Events

2009-02-04 Thread david

Hi,

I think that every body has understand, but there is no way to do $
('elem').click() on FF.
This work on IE, and simulate a real click on the element, but it's
not (I don't think !) in standard.
And thanks, because I did not know it works in Safari.

so you should have to use a tricks to use it.
If you like such a function, try to create your own, and extend the
element !

--
david

On 4 fév, 03:13, solidhex patr...@solidhex.com wrote:
 I should try asking this another way, because I dont think I was clear
 before.

 Is it possible to emulate the click() method that IE and Safari 3 seem
 to support using Prototype?

 I

 On Jan 30, 4:08 am, Радослав Станков rstan...@gmail.com wrote:

  Firing native events like click and others is not available.
  You can try with custom events -http://www.prototypejs.org/api/element/fire
  ( unfortunately, there isn't much documentation on the official site :
  ( , but google helps in this case)

  or use this hack witch jdalton wrote here :http://pastie.org/255119

  Element.addMethods({
  fire: Event.fire.wrap(function(proceed, element, eventName, memo)
  {
element = $(element);
var w, event, eventID;
$w(eventName)._each(function(name) {
  // use original fire if it's a custom:event
  if (name.include(':'))
return proceed(element, name, memo);

  // handle native events
  eventID = (element._prototypeEventID || [null])[0];
  if (!eventID || !(w = Event.cache[eventID][name])) return
  false;

  // poor man's event object
  event = Event.extend({ });
  event.eventName = name;
  event.memo = memo || { };

  // execute event wrappers
  w._each(function(wrapper) { wrapper(event) });
});
return element;
  })
});

  p.s. This $(ement).fire('click') must be in the core I think, but
  don't have enough free time lately to fire a ticket
--~--~-~--~~~---~--~~
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: grabbing form values from multiple pages.

2009-02-04 Thread david

Hi sqaured,

It seems, that you only transmit the value of the previous form to the
DB, and for the third form to be generated, you need to pass first AND
second one !
So this could be done in a couple of lines (I think).

Give us your code, or a sample, we will surelly help.

--
david

On 2 fév, 19:00, Squared jpr...@hancousa.com wrote:
 The abbreviated question:
 How do I pass the value of a list item on page 1 AND page 2 to a third
 page so I can use the values in php and mySQL?

 The extended version:
 I have three form lists with select values taken from a mySQL
 database. The second list is generated based on the selection from the
 first, and the third is generated based on the selection from the
 first and second. Finally, a table is generated based on all values
 selected in all three. I have this working with php, but the page
 reloads after every list item is selected. I have done a lot of
 research and have almost gotten this to work without a reload using
 AJAX from Prototype, but I am running into a problem. The second list
 generates correctly, but the third does not. This is because my mySQL
 statement pulls the values from the first two lists. Since the page is
 not reloaded it only sees the value of the second list and not the
 first. How can I pass the value from the first list and the second
 list (which are on two separate pages) to the third list?
--~--~-~--~~~---~--~~
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: grabbing form values from multiple pages.

2009-02-04 Thread Richard Quadling

2009/2/4 david david.brill...@gmail.com:

 Hi sqaured,

 It seems, that you only transmit the value of the previous form to the
 DB, and for the third form to be generated, you need to pass first AND
 second one !
 So this could be done in a couple of lines (I think).

 Give us your code, or a sample, we will surelly help.

 --
 david

 On 2 fév, 19:00, Squared jpr...@hancousa.com wrote:
 The abbreviated question:
 How do I pass the value of a list item on page 1 AND page 2 to a third
 page so I can use the values in php and mySQL?

 The extended version:
 I have three form lists with select values taken from a mySQL
 database. The second list is generated based on the selection from the
 first, and the third is generated based on the selection from the
 first and second. Finally, a table is generated based on all values
 selected in all three. I have this working with php, but the page
 reloads after every list item is selected. I have done a lot of
 research and have almost gotten this to work without a reload using
 AJAX from Prototype, but I am running into a problem. The second list
 generates correctly, but the third does not. This is because my mySQL
 statement pulls the values from the first two lists. Since the page is
 not reloaded it only sees the value of the second list and not the
 first. How can I pass the value from the first list and the second
 list (which are on two separate pages) to the third list?
 


What is probably going to be of most use is to understand sessions.

Essentially a session (accessed in PHP using the super global
$_SESSION) allows you to remember data between requests.

A session is unique to a connection (a user normally). If they haven't
got a session ID, they they will be given a new one.

Read about sessions at http://docs.php.net/sessions and
http://docs.php.net/manual/en/book.session.php

-- 
-
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: grabbing form values from multiple pages.

2009-02-04 Thread Richard Quadling

2009/2/4 Richard Quadling rquadl...@googlemail.com:
 2009/2/4 david david.brill...@gmail.com:

 Hi sqaured,

 It seems, that you only transmit the value of the previous form to the
 DB, and for the third form to be generated, you need to pass first AND
 second one !
 So this could be done in a couple of lines (I think).

 Give us your code, or a sample, we will surelly help.

 --
 david

 On 2 fév, 19:00, Squared jpr...@hancousa.com wrote:
 The abbreviated question:
 How do I pass the value of a list item on page 1 AND page 2 to a third
 page so I can use the values in php and mySQL?

 The extended version:
 I have three form lists with select values taken from a mySQL
 database. The second list is generated based on the selection from the
 first, and the third is generated based on the selection from the
 first and second. Finally, a table is generated based on all values
 selected in all three. I have this working with php, but the page
 reloads after every list item is selected. I have done a lot of
 research and have almost gotten this to work without a reload using
 AJAX from Prototype, but I am running into a problem. The second list
 generates correctly, but the third does not. This is because my mySQL
 statement pulls the values from the first two lists. Since the page is
 not reloaded it only sees the value of the second list and not the
 first. How can I pass the value from the first list and the second
 list (which are on two separate pages) to the third list?
 


 What is probably going to be of most use is to understand sessions.

 Essentially a session (accessed in PHP using the super global
 $_SESSION) allows you to remember data between requests.

 A session is unique to a connection (a user normally). If they haven't
 got a session ID, they they will be given a new one.

 Read about sessions at http://docs.php.net/sessions and
 http://docs.php.net/manual/en/book.session.php

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


By using a session, you don't need to store data in the DB until the
final request. Allowing the user to spend as long as they want
travelling between the different pages until they are ready.

Ok, for me, I log my sessions in a DB, but that's another story.



-- 
-
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: grabbing form values from multiple pages.

2009-02-04 Thread Kevin Smith
Seeing as your using AJAX, why even bother with more than one page. You 
can do everything on one page.

Richard Quadling wrote:
 2009/2/4 Richard Quadling rquadl...@googlemail.com:
   
 2009/2/4 david david.brill...@gmail.com:
 
 Hi sqaured,

 It seems, that you only transmit the value of the previous form to the
 DB, and for the third form to be generated, you need to pass first AND
 second one !
 So this could be done in a couple of lines (I think).

 Give us your code, or a sample, we will surelly help.

 --
 david

 On 2 fév, 19:00, Squared jpr...@hancousa.com wrote:
   
 The abbreviated question:
 How do I pass the value of a list item on page 1 AND page 2 to a third
 page so I can use the values in php and mySQL?

 The extended version:
 I have three form lists with select values taken from a mySQL
 database. The second list is generated based on the selection from the
 first, and the third is generated based on the selection from the
 first and second. Finally, a table is generated based on all values
 selected in all three. I have this working with php, but the page
 reloads after every list item is selected. I have done a lot of
 research and have almost gotten this to work without a reload using
 AJAX from Prototype, but I am running into a problem. The second list
 generates correctly, but the third does not. This is because my mySQL
 statement pulls the values from the first two lists. Since the page is
 not reloaded it only sees the value of the second list and not the
 first. How can I pass the value from the first list and the second
 list (which are on two separate pages) to the third list?
 
 What is probably going to be of most use is to understand sessions.

 Essentially a session (accessed in PHP using the super global
 $_SESSION) allows you to remember data between requests.

 A session is unique to a connection (a user normally). If they haven't
 got a session ID, they they will be given a new one.

 Read about sessions at http://docs.php.net/sessions and
 http://docs.php.net/manual/en/book.session.php

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

 

 By using a session, you don't need to store data in the DB until the
 final request. Allowing the user to spend as long as they want
 travelling between the different pages until they are ready.

 Ok, for me, I log my sessions in a DB, but that's another story.



   

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

2009-02-04 Thread david

Hi kidbrax,

try this code:

body


div id=1 style=width:100px;height:100px;background-
color:red;overflow:hidden;border:2px solid blue;
  div id=2 style=width:100px;height:100px;position:relative;left:
0px;top:0px;background-color:red;
this is my text - this is my text - this is my text - this is my
text - this is my text
  /div
/div
br /br /
button onclick=$('2').setStyle({left:'0px',top:'0px'});reset/
button
br /
button onclick=new Effect.Morph('2',{style:{left:'100px'}});slide
right/button
br /
button onclick=new Effect.Morph('2',{style:{left:'-100px'}});slide
left/button
br /
button onclick=new Effect.Morph('2',{style:{top:'100px'}});slide
bottom/button
br /
button onclick=new Effect.Morph('2',{style:{top:'-100px'}});slide
top/button

script type=text/javascript

function doFire(elem){
elem=$(elem);
var newEvt = '';
elem.fireEvent(click, newEvt);
alert('event fire ok');
}

br /
$('2').observe('click',function(){ alert('click received by DIV
id=2'); });


/script
/body


I hope you will find what you need?

--
david

On 3 fév, 02:14, kidbrax braxton.be...@gmail.com wrote:
 Anyone know of a way to do a SlideRight/SlideLeft?  I have seen the
 BlindRight method but don't want my text squished down during the
 transition.
--~--~-~--~~~---~--~~
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: delayedobserver doesn't work with single character id

2009-02-04 Thread david

Hi kidbrax,

do you have a live code i can use to test what you say?
btw, I'm quite surprise that no one has ever use protopype functions
to send query to Google ??

--
david

On 3 fév, 20:36, kidbrax braxton.be...@gmail.com wrote:
 I am setting up a form to query our Google Mini.  Google's default
 parameter for the search term is 'q'.  So you give your text input a
 name/id of 'q'  I did this and setup a delayedobserver to trigger my
 request.  However, it is never triggered.  If I change the name/id to
 anything longer than one character it works.  But if I change it back
 to 'q', a single character, it does not work.  Is there some sort of
 requirement that needs names/ids to be more than one character?
--~--~-~--~~~---~--~~
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: Who can tell me script.aculo.us's tree structure code like exploers?

2009-02-04 Thread david

Hi wangsuya,

I've found that on Google.
look at http://tafel.developpez.com/site/lang/en/samples.php
it's a tree class based on prototype and scriptaculous.

does it help??

--
david

On 2 fév, 02:15, wangsuya wang.s...@gmail.com wrote:
 Dear everyone

    I am trying to find tree structure which has forlders like
 exploers, I used tree to search at this group but did not find the
 source. I hope someone can tell me the source. Thanks in advance.

  Wang Suya
--~--~-~--~~~---~--~~
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: Hash#filter returns an Array?

2009-02-04 Thread ColinFine



On Feb 3, 2:18 pm, T.J. Crowder t...@crowdersoftware.com wrote:
 Hi,

  Maybe filter should be an alias of findall for arrays, but shouldn't
  it really return a hash for hashes?

 FWIW (and it ain't much, I'm not a decision maker on Prototype stuff),
 in my opinion it would be an _extremely_ bad idea for Hash to break
 the contract documented for Enumerable.

  ...in ruby, which Prototype is supposed to be modeled after.

 Prototype has been split off from Ruby for a long time now.  I'd
 venture to say that most people using Prototype do not use and may
 well never have even seen Ruby.  PHP seems to be the server-side
 language I see most in code snippets from people asking questions.
 --

I'm sure I'm not the only one who came to Prototype/Scripty through
symfony, which is a PHP framework. I don't know any Ruby (or Rails)

Colin

--~--~-~--~~~---~--~~
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] Event bubbling in prototype 1.6

2009-02-04 Thread Vladimir Ghetau

Hi ,

In 1.6 version of prototype is missing, reasons are provided in
documentation.

There's been long discussions on how this should be achieved, is there
any common practice of handling event bubbling using prototype?

Best Regards,
Vladimir Ghetau

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



[Proto-Scripty] Re: Event bubbling in prototype 1.6

2009-02-04 Thread Peter De Berdt

On 04 Feb 2009, at 15:39, Vladimir Ghetau wrote:

 In 1.6 version of prototype is missing, reasons are provided in
 documentation.

 There's been long discussions on how this should be achieved, is there
 any common practice of handling event bubbling using prototype?

We're using an extra library called NWEvents (combined with  
NWMatcher), but only for capturing the events. This library allows to  
even capture non-bubbling events such as form submit and input:focus  
and input:blur. As soon as the event is captured, it's delegated to  
Prototype-based classes. Works perfectly.

http://code.google.com/p/nwevents/


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-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: div inside select/select tags?

2009-02-04 Thread eulerss

i think that your problem is in this line

select id=box2 onchange=ajaxUpdater('ajax_day', '/ajax/
populate.php?show=daymonth=' + getsel('box2')
  div id='ajax_regions'/div
  /select

as far as i know you cannot use a div inside a select, check this link
for help

http://mmonreal.wordpress.com/2007/11/




On 4 feb, 00:16, T.J. Crowder t...@crowdersoftware.com wrote:
 Hi Richie,

  Now,
    select id=box2 onchange=ajaxUpdater('ajax_day', '/ajax/
  populate.php?show=daymonth=' + getsel('box2')
        div id='ajax_regions'/div
    /select

  , doesn't work...

 That's because it's invalid HTML.  You can't put divs inside select
 elements.  I'm pretty sure only option and optgroup are allowed, but
 in any case I'm certain div isn't.  You can use the W3C Markup
 Validator[1] to keep your HTML valid.

 [1]http://validator.w3.org

 With your updated example of the select box within the div and
 replaced via an Ajax.Updater:  Using innerHTML to create form elements
 doesn't work reliably, and under the covers Ajax.Updater uses
 Element#update, which uses innerHTML.  Separate from your specific
 problem of the event handler not being called (that could be easily
 solved using Event#observe), you'll run into issues with some browsers
 not recognizing the replaced select box at all.  You pretty much have
 to add form elements using DOM methods (appendChild and the like).

 I take it the goal is to change the options available within the
 select box when the value changes?  (OT: Doesn't that make for a
 jittery user experience?)  Rather than using HTML, I think you're
 better off manipulating the options array of the select box directly.
 It's been years since I did that, so I'm sure what I used to do is old-
 fashioned -- I'll leave it to you to Google changing the options, or
 for someone who's done it more recently to chime in.

 So, not a complete answer, but hopefully it's useful to know what's
 going wrong...

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

 On Feb 4, 12:41 am, Richie M i...@linuxbox.co.uk wrote:



  Hi,

  I have a form with three drop down select boxes in it. I'd like the
  second box to populate when an option is selected in the first, and
  for the third to populate when an option is selected from the second.

  In the first select box, I use onchange to call a php script:

  select id='box1' onchange=ajaxUpdater('ajax_regions', '/ajax/
  populate.php?show=monthid=' + getsel('box1')
    optionsomething/option
  /select

  Now,
    select id=box2 onchange=ajaxUpdater('ajax_day', '/ajax/
  populate.php?show=daymonth=' + getsel('box2')
        div id='ajax_regions'/div
    /select

  , doesn't work, so I'm forced to use:

     div id='ajax_regions'
      select id=box2
      /select
     /div

  , and get my php code to output something like:

     select id='box2' onchange=ajaxUpdater('ajax_day', '/ajax/
  populate.php?show=daymonth=' + getsel('box2')
       option1/option
     /select

  Unfortunately, the onchange in the second select box doesn't fire. Is
  this because it doesn't parse the javascript outputted by the php
  code?

  Is there a way around this? Or perhaps a solution to the div inside
  select problem?

  Thanks in advance!- Ocultar texto de la cita -

 - Mostrar texto de la cita -
--~--~-~--~~~---~--~~
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: grabbing form values from multiple pages.

2009-02-04 Thread Walter Lee Davis

Sorry, just tried this and realized that it won't work as written  
(getInputs only finds input tags, as you'd expect, not selects). Try  
this:

var element=$$('#your_form select').find(function(elm){

Walter

On Feb 4, 2009, at 9:23 AM, Walter Lee Davis wrote:

   var element = $('your_form).getInputs('select').find(function(elm){


--~--~-~--~~~---~--~~
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: grabbing form values from multiple pages.

2009-02-04 Thread Squared

Walter,
I could not get this to work, but, to be honest; I could have
something else wrong, because I am not certain how this new approach
is working exactly. (I am new to prototype  AJAX). I don’t quite
understand, or I am not following the logic.. Are we still using
multiple pages?  Is there even a way to dumb this down a bit for me or
should I just concede that this is over my head??? I would really like
to figure this out if possible, but I don’t want someone to write
everything for me either.


On Feb 4, 10:20 am, Walter Lee Davis wa...@wdstudio.com wrote:
 Sorry, just tried this and realized that it won't work as written  
 (getInputs only finds input tags, as you'd expect, not selects). Try  
 this:

 var element=$$('#your_form select').find(function(elm){

 Walter

 On Feb 4, 2009, at 9:23 AM, Walter Lee Davis wrote:

     var element = $('your_form).getInputs('select').find(function(elm){
--~--~-~--~~~---~--~~
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] Aborting an ajax call

2009-02-04 Thread Red
I've built a chess game using Prototype's ajax wrappers. Sometimes, a server
simply doesn't respond to a request that a user has made. You know how that
works. You click on a link to a page and you don't get a response. You hit
the stop button, click on the link again, and the pag shows up no problem.
The problem is that every once and a while (maybe once every couple of
games) a user will attempt to make a move, but their request will never make
it to the server. They can just refresh the page in those intances, but
that's yucky. I'd prefer the code to abort the request and make a new one if
a response hasn't been received from the server within 3 seconds or so.

The XMLHTTPRequest object has an abort method. It doesn't appear that the
ajax object from Prototype has this method. How do I go about aborting a
request if no response is received within a certain time frame? Thanks in
advance.

AC

--~--~-~--~~~---~--~~
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: Rerouting Events

2009-02-04 Thread solidhex

Thanks David, I'll see what I come up with ;)

On Feb 4, 3:14 am, david david.brill...@gmail.com wrote:
 Hi,

 I think that every body has understand, but there is no way to do $
 ('elem').click() on FF.
 This work on IE, and simulate a real click on the element, but it's
 not (I don't think !) in standard.
 And thanks, because I did not know it works in Safari.

 so you should have to use a tricks to use it.
 If you like such a function, try to create your own, and extend the
 element !

 --
 david

 On 4 fév, 03:13, solidhex patr...@solidhex.com wrote:

  I should try asking this another way, because I dont think I was clear
  before.

  Is it possible to emulate the click() method that IE and Safari 3 seem
  to support using Prototype?

  I

  On Jan 30, 4:08 am, Радослав Станков rstan...@gmail.com wrote:

   Firing native events like click and others is not available.
   You can try with custom events 
   -http://www.prototypejs.org/api/element/fire
   ( unfortunately, there isn't much documentation on the official site :
   ( , but google helps in this case)

   or use this hack witch jdalton wrote here :http://pastie.org/255119

   Element.addMethods({
   fire: Event.fire.wrap(function(proceed, element, eventName, memo)
   {
 element = $(element);
 var w, event, eventID;
 $w(eventName)._each(function(name) {
   // use original fire if it's a custom:event
   if (name.include(':'))
 return proceed(element, name, memo);

   // handle native events
   eventID = (element._prototypeEventID || [null])[0];
   if (!eventID || !(w = Event.cache[eventID][name])) return
   false;

   // poor man's event object
   event = Event.extend({ });
   event.eventName = name;
   event.memo = memo || { };

   // execute event wrappers
   w._each(function(wrapper) { wrapper(event) });
 });
 return element;
   })
 });

   p.s. This $(ement).fire('click') must be in the core I think, but
   don't have enough free time lately to fire a ticket
--~--~-~--~~~---~--~~
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: grabbing form values from multiple pages.

2009-02-04 Thread Walter Lee Davis

Here's a local example that works in Firefox.

http://pastie.org/379612

Save those three files somewhere and try it out.

Here's an example that works with a server call (not tested):

http://pastie.org/379637

I don't believe this will work in IE, you can't update the inner bits  
of a select and have it work like a form element afterward. For that,  
you will need to use the

new Option(text,value)

syntax inside a loop.

Walter


On Feb 4, 2009, at 12:05 PM, Squared wrote:

 Walter,
 I could not get this to work, but, to be honest; I could have
 something else wrong, because I am not certain how this new approach
 is working exactly. (I am new to prototype  AJAX). I don’t quite
 understand, or I am not following the logic.. Are we still using
 multiple pages?  Is there even a way to dumb this down a bit for me or
 should I just concede that this is over my head??? I would really like
 to figure this out if possible, but I don’t want someone to write
 everything for me either.


--~--~-~--~~~---~--~~
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] new Element(label), problem with 'for' attribute

2009-02-04 Thread Diodeus

IE seems to barf when setting the for attribute of a label with the
element constructor:

$(element).insert(new Element(label, { id:'something', for:'check1',
className:'FBRadioLabelLeft' }))

Should result in:

label for=check1 id=something/label

It seems IE thinks it's starting a for-loop or something.

Is there a work-around for 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
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: new Element(label), problem with 'for' attribute

2009-02-04 Thread Diodeus

Thanks, Walter, that worked. It does feel a little 'unnatural'
though. :)

On Feb 4, 4:21 pm, Walter Lee Davis wa...@wdstudio.com wrote:
 Did you try it with the names of the attributes quoted?

 {'id': 'foo', 'for':'bar', 'class':'baz'}

 Walter

 On Feb 4, 2009, at 4:13 PM, Diodeus wrote:



  IE seems to barf when setting the for attribute of a label with the
  element constructor:

  $(element).insert(new Element(label, { id:'something', for:'check1',
  className:'FBRadioLabelLeft' }))
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Prototype  script.aculo.us group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: new Element(label), problem with 'for' attribute

2009-02-04 Thread Walter Lee Davis

Hey, man, this is IE we're talking 'bout here... Of course it's  
unnatural!

Walter

On Feb 4, 2009, at 4:31 PM, Diodeus wrote:

 It does feel a little 'unnatural'
 though. :)


--~--~-~--~~~---~--~~
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] validation for alphanumeric field/sequence

2009-02-04 Thread Michael

Hi - I want to use this validation for an alphanumeric field.

return Validation.get('IsEmpty').test(v) ||  !/\W/.test(v)

But I only want the field to be valid if the sequence is V3 or
B40009 or J50008 (for example). It will be valid only for a few letter/
number sequences. I can't really wrap my mind around the regular
expressions right now. What would the syntax be just to stub in a few
sequences that would validate?

Thanks for all your 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: grabbing form values from multiple pages.

2009-02-04 Thread Walter Lee Davis

I deliberately made the server side a sketch. I use a framework here  
that lets me write something that terse and get a result. If you would  
let me know what server environment you are working in, I can  
recommend some additional information.

Walter

On Feb 4, 2009, at 5:06 PM, Squared wrote:

 If you or anyone else
 can give me any more info on the server side it would be greatly
 appreciated.


--~--~-~--~~~---~--~~
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: delayedobserver doesn't work with single character id

2009-02-04 Thread kidbrax

Unfortunately, I don't.  It is on our intranet that is stuck behind a
firewall.  If I get a chance I will do a mockup externally.

On Feb 4, 5:46 am, david david.brill...@gmail.com wrote:
 Hi kidbrax,

 do you have a live code i can use to test what you say?
 btw, I'm quite surprise that no one has ever use protopype functions
 to send query to Google ??

 --
 david

 On 3 fév, 20:36, kidbrax braxton.be...@gmail.com wrote:

  I am setting up a form to query our Google Mini.  Google's default
  parameter for the search term is 'q'.  So you give your text input a
  name/id of 'q'  I did this and setup a delayedobserver to trigger my
  request.  However, it is never triggered.  If I change the name/id to
  anything longer than one character it works.  But if I change it back
  to 'q', a single character, it does not work.  Is there some sort of
  requirement that needs names/ids to be more than one character?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Prototype  script.aculo.us group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: new Element(label), problem with 'for' attribute

2009-02-04 Thread Tobie Langel

You can also try:

{id: 'foo', htmlFor:'bar', className:'baz'}


On Feb 4, 10:46 pm, Walter Lee Davis wa...@wdstudio.com wrote:
 Hey, man, this is IE we're talking 'bout here... Of course it's  
 unnatural!

 Walter

 On Feb 4, 2009, at 4:31 PM, Diodeus wrote:

  It does feel a little 'unnatural'
  though. :)
--~--~-~--~~~---~--~~
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: div inside select/select tags?

2009-02-04 Thread RobG



On Feb 4, 10:41 am, Richie M i...@linuxbox.co.uk wrote:
 Hi,

 I have a form with three drop down select boxes in it. I'd like the
 second box to populate when an option is selected in the first, and
 for the third to populate when an option is selected from the second.

 In the first select box, I use onchange to call a php script:

 select id='box1' onchange=ajaxUpdater('ajax_regions', '/ajax/
 populate.php?show=monthid=' + getsel('box1')

Apart from the invalid HTML (pointed out by TJ), it is very unwise to
use an onchange handler with a select element if there is any chance
the form will be used in IE.  If a user tries to navigate the options
using the cursor keys in IE, a change event will fire each time the
key is pressed and changes the selected option - I don't think that is
what you want.

I don't know what the getsel function does, however I suspect you are
using the ID attribute inappropriately.  Option elements have a value
attribute[1] that is supposed to be used to send data to the server,
select elements have a DOM value property that is determined from the
selected option, so why not use:

  select onblur=ajaxUpdater(... + this.value);
option value=value 0value 0
option value=value 1value 1
option value=value 2value 2
  /select


Or use an explicit update the form button.

1. The text attribute can be used to, however due to IE's non-
compliance with the W3C standard relating to use of text as the option
value, it is easier to explicitly use the value attribute.


--
Rob
--~--~-~--~~~---~--~~
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] Modifier Keys

2009-02-04 Thread tazz_ben

Forgive me if this is a dumb question and this is some simple property
in script.aculo.us:

I'm wondering if there is a way on a droppable to detect if the shift
key is down when the object is dropped.  I know that there is a
property for shift key off of event, but I've only seen code examples
with this tied to a mouse click.  What I really want is to determine
this at the moment its dropped as this would allow the user any time
in the drag on whether or not to use the shift modifier.

--~--~-~--~~~---~--~~
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: Hash#filter returns an Array?

2009-02-04 Thread T.J. Crowder

 Actually the code $H(originalHash.reject(...)) doesn't return the
 correct value.

Ah, sorry 'bout that, should have tried it.  Clearly I don't create
hashes from arrays very often... ;-)

-- T.J.

On Feb 4, 8:49 pm, Brad bradavo...@gmail.com wrote:
 Actually the code $H(originalHash.reject(...)) doesn't return the
 correct value. Example:
 var originalHash = $H({'a':1,'b':2,'c':3,'d':4});
 var newArray = originalHash.filter(function(i) { return i.value %
 2; })
 = $H(newArray) doesn't have the keys 'a' and 'c'.

 You have to call:
 newArray.inject($H(),function(h,i){
         h.set(i[0],i[1])
         return h

 })

 I wasn't suggesting fixing it in a v1.x release, as APIs shouldn't be
 changed in minor releases. Though it is definitely something to keep
 in mind for Prototype v2.0.

 On Feb 3, 10:20 pm, T.J. Crowder t...@crowdersoftware.com wrote:

  Hi Brad,

   The contract states that Enumerable#reject Returns all the elements
   for which the iterator returned false.

  Here's the opening line of the Enumerable#reject docs:

      reject(iterator[, context]) - Array

  Similarly, findAll (the one we started with, via its alias filter):

      findAll(iterator[, context]) - Array

  That's not an assumption, that's a documented return value.  Changing
  these to return a Hash if the original is a Hash breaks the contract
  and breaks compatibility with previous releases.  Whereas getting the
  result you want is trivial:

      result = $H(originalHash.reject(...));

   It's entirely intuitive that...

  I'm not talking intuitive vs. non-intuitive (it's far too subjective),
  I'm talking the current documented (and implemented!) behavior.
  Remember that Enumerable is a contract, and code dealing with an
  Enumerable may not happen to know that it's dealing with a Hashy kind
  of Enumerable. :-)

  I do agree -- not that it matters! ;-) -- that for (say) 2.0, an
  argument can be made for changing Enumerable to say that for these
  kinds of methods, it returns an Enumerable (not an Array), and that
  concrete classes should (where appropriate) return the same type as
  the original.  But (due respect to kangax) to me that's not a bug,
  that's a request for API enhancement, and not the kind of thing to do
  in a dot release or by making Hash a special case.

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

  On Feb 3, 10:20 pm, Brad bradavo...@gmail.com wrote:

   The contract states that Enumerable#reject Returns all the elements
   for which the iterator returned false. It's entirely intuitive that
   it will return the same data type as the object it was called on.
   Otherwise Hash#reject() is practically useless.

   The only part of the documentation that is wrong is the assumption
   that it will always return an Array. Perhaps that was an oversight
   when Hash was left out as a subclass of Enumerable in the
   documentation.

   Ruby fixed their documentation:
   Hash#reject:http://www.ruby-doc.org/core/classes/Hash.html#M002901
   Enumerable#reject:http://www.ruby-doc.org/core/classes/Enumerable.html#M003157

   On Feb 3, 1:56 pm, T.J. Crowder t...@crowdersoftware.com wrote:

Kangax,

 Didn't we establish that this is a bug? ; )

Not as far as I'm concerned it isn't.  It returns what its documented
contract says it returns.  The only error IMHO is in the
interpretation that it would do something other than what the
documentation says it will do.  You're not suggesting it should break
the Enumerable contract, are you?

-- T.J. ;-)

On Feb 3, 7:03 pm, kangax kan...@gmail.com wrote:

 On Feb 3, 1:54 pm, Brad bradavo...@gmail.com wrote:

  TJ, thanks for correcting the docs. I hadn't noticed that error
  either.

  Are you suggesting that there no intersection of Prototype and Ruby
  communities? I only know of Prototype because of Ruby on Rails.

  Let's take Hash#reject() as an example. Let's say I'm moving server-
  side Ruby code to my Prototype-enhanced client-side.

  Ruby code:
  { a = 100, b = 200, c = 300 }.reject {|key, value| key ==
  b }
  = {a=100, c=300}

  Translated to Javascript:
  $H({ a: 100, b: 200, c: 300 }).reject(function(i) { return 
  i.key
  == b })
  = [[a, 100], [c, 300]]

  Prototype returns an array? What good is an array if I started with 
  a
  hash? It is intuitive that a reject() method returns a subset of the
  original data structure and not convert it to an entirely different
  one.

 Didn't we establish that this is a bug? ; )

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