[Proto-Scripty] Re: Best way to turn an argument into Enumerable if it's not already

2009-08-04 Thread Cédric

Yes, sorry about that. Your solution is neat, 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 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] IE 8 Bug

2009-08-04 Thread Jeztah

Afternoon Guys/Gals.


I have a weird error in IE8.

removeSuggestResults = function() {
$$('.editsuggestResults').each(function(el) {
$(el).remove();
});
}

Doesnt seem to work in Internet explorer 8.

The Element exists and was added dynamically to the DOM and has the
classname.

I read somewhere about IE8 not adding classnames to elements when the
classname is in the options of new Element(); so i called $
('suggestiveResults').addClassName('editsuggestResults');
 to be safe. But it seems to not be working. I also cant get a copy of
firebug lite as the site seems to be down so i cant test the element
to make sure it has the class

Can anyone help ?


Thanks in advance

Alex
--~--~-~--~~~---~--~~
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: IE 8 Bug

2009-08-04 Thread Jeff Conklin

Glad you fixed it.. but can you share?

- J e f f  C o n k l i n -
- AOL IM - a14piece
- http://www.getoutsidenj.com
- http://www.carabs.com



On Tue, Aug 4, 2009 at 9:29 AM, Alex
McAuleywebmas...@thecarmarketplace.com wrote:

 Never mind i fixed it !..

 Goddam IE8 i hate it already - only been using it 1 hour !


 Alex Mcauley
 http://www.thevacancymarket.com
 - Original Message -
 From: Jeztah webmas...@thecarmarketplace.com
 To: Prototype  script.aculo.us prototype-scriptaculous@googlegroups.com
 Sent: Tuesday, August 04, 2009 2:21 PM
 Subject: [Proto-Scripty] IE 8 Bug



 Afternoon Guys/Gals.


 I have a weird error in IE8.

 removeSuggestResults = function() {
 $$('.editsuggestResults').each(function(el) {
 $(el).remove();
 });
 }

 Doesnt seem to work in Internet explorer 8.

 The Element exists and was added dynamically to the DOM and has the
 classname.

 I read somewhere about IE8 not adding classnames to elements when the
 classname is in the options of new Element(); so i called $
 ('suggestiveResults').addClassName('editsuggestResults');
 to be safe. But it seems to not be working. I also cant get a copy of
 firebug lite as the site seems to be down so i cant test the element
 to make sure it has the class

 Can anyone help ?


 Thanks in advance

 Alex
 



 


--~--~-~--~~~---~--~~
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: IE 8 Bug

2009-08-04 Thread Alex McAuley

addClassName() worked but the page had cached and not updated my code after 
refresh ... shut the browser and tried again - worked first time

Now i am looking for a way to detect if the browser is IE8 or not as the css 
renders the same as FF in IE8 but not in IE7 !


Alex Mcauley
http://www.thevacancymarket.com
- Original Message - 
From: Jeff Conklin car...@gmail.com
To: prototype-scriptaculous@googlegroups.com
Sent: Tuesday, August 04, 2009 2:31 PM
Subject: [Proto-Scripty] Re: IE 8 Bug



 Glad you fixed it.. but can you share?

 - J e f f  C o n k l i n -
 - AOL IM - a14piece
 - http://www.getoutsidenj.com
 - http://www.carabs.com



 On Tue, Aug 4, 2009 at 9:29 AM, Alex
 McAuleywebmas...@thecarmarketplace.com wrote:

 Never mind i fixed it !..

 Goddam IE8 i hate it already - only been using it 1 hour !


 Alex Mcauley
 http://www.thevacancymarket.com
 - Original Message -
 From: Jeztah webmas...@thecarmarketplace.com
 To: Prototype  script.aculo.us 
 prototype-scriptaculous@googlegroups.com
 Sent: Tuesday, August 04, 2009 2:21 PM
 Subject: [Proto-Scripty] IE 8 Bug



 Afternoon Guys/Gals.


 I have a weird error in IE8.

 removeSuggestResults = function() {
 $$('.editsuggestResults').each(function(el) {
 $(el).remove();
 });
 }

 Doesnt seem to work in Internet explorer 8.

 The Element exists and was added dynamically to the DOM and has the
 classname.

 I read somewhere about IE8 not adding classnames to elements when the
 classname is in the options of new Element(); so i called $
 ('suggestiveResults').addClassName('editsuggestResults');
 to be safe. But it seems to not be working. I also cant get a copy of
 firebug lite as the site seems to be down so i cant test the element
 to make sure it has the class

 Can anyone help ?


 Thanks in advance

 Alex
 



 


 
 


--~--~-~--~~~---~--~~
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: IE 8 Bug

2009-08-04 Thread Alex McAuley

Again found a fix .

if(document.documentMode = 8) {
   ..
   }

For anyone interested - detects IE8 !!


Alex Mcauley
http://www.thevacancymarket.com
- Original Message - 
From: Alex McAuley webmas...@thecarmarketplace.com
To: prototype-scriptaculous@googlegroups.com
Sent: Tuesday, August 04, 2009 2:33 PM
Subject: [Proto-Scripty] Re: IE 8 Bug



 addClassName() worked but the page had cached and not updated my code 
 after
 refresh ... shut the browser and tried again - worked first time

 Now i am looking for a way to detect if the browser is IE8 or not as the 
 css
 renders the same as FF in IE8 but not in IE7 !


 Alex Mcauley
 http://www.thevacancymarket.com
 - Original Message - 
 From: Jeff Conklin car...@gmail.com
 To: prototype-scriptaculous@googlegroups.com
 Sent: Tuesday, August 04, 2009 2:31 PM
 Subject: [Proto-Scripty] Re: IE 8 Bug



 Glad you fixed it.. but can you share?

 - J e f f  C o n k l i n -
 - AOL IM - a14piece
 - http://www.getoutsidenj.com
 - http://www.carabs.com



 On Tue, Aug 4, 2009 at 9:29 AM, Alex
 McAuleywebmas...@thecarmarketplace.com wrote:

 Never mind i fixed it !..

 Goddam IE8 i hate it already - only been using it 1 hour !


 Alex Mcauley
 http://www.thevacancymarket.com
 - Original Message -
 From: Jeztah webmas...@thecarmarketplace.com
 To: Prototype  script.aculo.us
 prototype-scriptaculous@googlegroups.com
 Sent: Tuesday, August 04, 2009 2:21 PM
 Subject: [Proto-Scripty] IE 8 Bug



 Afternoon Guys/Gals.


 I have a weird error in IE8.

 removeSuggestResults = function() {
 $$('.editsuggestResults').each(function(el) {
 $(el).remove();
 });
 }

 Doesnt seem to work in Internet explorer 8.

 The Element exists and was added dynamically to the DOM and has the
 classname.

 I read somewhere about IE8 not adding classnames to elements when the
 classname is in the options of new Element(); so i called $
 ('suggestiveResults').addClassName('editsuggestResults');
 to be safe. But it seems to not be working. I also cant get a copy of
 firebug lite as the site seems to be down so i cant test the element
 to make sure it has the class

 Can anyone help ?


 Thanks in advance

 Alex
 



 


 



 
 


--~--~-~--~~~---~--~~
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: IE 8 Bug

2009-08-04 Thread Jeff Conklin

Nice.. Thanks.

- J e f f  C o n k l i n -
- AOL IM - a14piece
- http://www.getoutsidenj.com
- http://www.carabs.com


On Tue, Aug 4, 2009 at 9:36 AM, Alex
McAuleywebmas...@thecarmarketplace.com wrote:

 Again found a fix .

 if(document.documentMode = 8) {
   ..
   }

 For anyone interested - detects IE8 !!


 Alex Mcauley
 http://www.thevacancymarket.com
 - Original Message -
 From: Alex McAuley webmas...@thecarmarketplace.com
 To: prototype-scriptaculous@googlegroups.com
 Sent: Tuesday, August 04, 2009 2:33 PM
 Subject: [Proto-Scripty] Re: IE 8 Bug



 addClassName() worked but the page had cached and not updated my code
 after
 refresh ... shut the browser and tried again - worked first time

 Now i am looking for a way to detect if the browser is IE8 or not as the
 css
 renders the same as FF in IE8 but not in IE7 !


 Alex Mcauley
 http://www.thevacancymarket.com
 - Original Message -
 From: Jeff Conklin car...@gmail.com
 To: prototype-scriptaculous@googlegroups.com
 Sent: Tuesday, August 04, 2009 2:31 PM
 Subject: [Proto-Scripty] Re: IE 8 Bug



 Glad you fixed it.. but can you share?

 - J e f f  C o n k l i n -
 - AOL IM - a14piece
 - http://www.getoutsidenj.com
 - http://www.carabs.com



 On Tue, Aug 4, 2009 at 9:29 AM, Alex
 McAuleywebmas...@thecarmarketplace.com wrote:

 Never mind i fixed it !..

 Goddam IE8 i hate it already - only been using it 1 hour !


 Alex Mcauley
 http://www.thevacancymarket.com
 - Original Message -
 From: Jeztah webmas...@thecarmarketplace.com
 To: Prototype  script.aculo.us
 prototype-scriptaculous@googlegroups.com
 Sent: Tuesday, August 04, 2009 2:21 PM
 Subject: [Proto-Scripty] IE 8 Bug



 Afternoon Guys/Gals.


 I have a weird error in IE8.

 removeSuggestResults = function() {
 $$('.editsuggestResults').each(function(el) {
 $(el).remove();
 });
 }

 Doesnt seem to work in Internet explorer 8.

 The Element exists and was added dynamically to the DOM and has the
 classname.

 I read somewhere about IE8 not adding classnames to elements when the
 classname is in the options of new Element(); so i called $
 ('suggestiveResults').addClassName('editsuggestResults');
 to be safe. But it seems to not be working. I also cant get a copy of
 firebug lite as the site seems to be down so i cant test the element
 to make sure it has the class

 Can anyone help ?


 Thanks in advance

 Alex
 



 


 



 



 


--~--~-~--~~~---~--~~
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: Firefox v3.5

2009-08-04 Thread mindVex

I had similar problems - and found out that .down() or .select() fails
when the element's id that it's fetching is starting with a number.

So, $('test').down('ul, 1) failed for me, because the ul-element's id
was something like 1_23402922. I changed it to begin with a letter
(s_1_23402922) and it worked then.

On Jul 29, 2:59 pm, evrim erincev...@gmail.com wrote:
 No there is not a space in ID e is expression like div.classname
 and the code adds in front of it #id  after that the expression
 is
 #id div.classname and the expression does not work in this form
 on $A(root.querySelectorAll(e)).map(Element.extend); .
 but after commented this line code work well.

 On Jul 29, 3:45 pm, Alex McAuley webmas...@thecarmarketplace.com
 wrote:

  that has a space in it no ?

  ID's are not allowed spaces

  Alex Mcauleyhttp://www.thevacancymarket.com

  - Original Message -
  From: evrim erincev...@gmail.com
  To: Prototype  script.aculo.us prototype-scriptaculous@googlegroups.com
  Sent: Wednesday, July 29, 2009 12:29 PM
  Subject: [Proto-Scripty] Re: Firefox v3.5

  this change fixed only elements whose id = 0 so the new change fixed
  it well
    //e = # + id +   + e;
  I closed this row

  On Jul 29, 1:19 pm, evrim erincev...@gmail.com wrote:
   I have done that change but still there is an error then,
   I changed line 3339 (e = # + id +   + e;) to
   if (id != 0)
   e = # + id +   + e;

   Now it seems working

   On Jul 29, 12:00 pm, Mona Remlawi mona.reml...@gmail.com wrote:

Must be that you're using (dot) or (colon) in your ids.
This has been fixed, but not yet released. You can manually change in
prototype.js line:3338 to match
id = id.replace(/([\.:])/g, \\$1); // NOTE the $1 instead of $0

This fix will be a part of next release as it is in the trunk [1]

[1]http://github.com/sstephenson/prototype/blob/add69978e09653808aedec43...

cheers

--
mona

On Wed, Jul 29, 2009 at 10:54 AM, webbear1000normpo...@hotmail.com
wrote:

 Does it work with the latest stable release?

 On Jul 29, 8:49 am, evrim erincev...@gmail.com wrote:
 Nobody has problem like that?
 Select method in your codes can run well in Firefox 3.5

--~--~-~--~~~---~--~~
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] Autocompleter getSelectionId additional variables

2009-08-04 Thread Scrooge

Hello All,

I want to use the Ajax.Autocompleter class together with
getSelectionId in order to use the li ID of the chosen selection to
initiate further javascript actions. Anyway I would need to transfer
additional variables to the getSelectionId function. But as soon as I
try to send more variables to it, it does not work anymore:

This is more or less how it works (taken from the documentation):

new Ajax.Autocompleter('autocomplete_field', 'autocomplete_choices', '/
some/script', {
  paramName: 'searchterm',
  minChars: 5,
  indicator: 'status_field',
  afterUpdateElement : getSelectionId
});

function getSelectionId(text,li) {
alert (li.id + ' ' + 'ticketID');
}

And this is what I planned to do:

var parameter1 = 'something';
var parameter2 = 'blabla';
var parameter3 = 'anotherthing';

new Ajax.Autocompleter('autocomplete_field', 'autocomplete_choices', '/
some/script', {
  paramName: 'searchterm',
  minChars: 5,
  indicator: 'status_field',
  afterUpdateElement : getSelectionId
(text,li,parameter1,parameter2,parameter3)
});

function getSelectionId(text,li,parameter1,parameter2,parameter3) {
alert (li.id + ' ' + 'ticketID');
}

But this does not work. How can I send additional parameters to the
getSelectionId function?
Thanks in advance.

Best Regards,
Benedikt

--~--~-~--~~~---~--~~
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] Class with Ajax and onclick event

2009-08-04 Thread Liviu Timar

Hello,
This is my first post here. Thus, I'll like to say hello to everybody
in this community and I want to appologize if this question was asked
before.

I am a web developer for a site that has 1mil+ visitors/month: www
[dot] ziare [dot] ro, and I want to use the Prototype Framework to
make an element refresh itself (with an scriptaculous Effect)
periodically.

This is my class:

var Dynamic = Class.create({
initialize: function(selector, container, script)
{
this.selector  = selector;
this.script= script;
this.container = container;

this.changeContent = 
this.changeContent.bindAsEventListener(this);

this.getContent();
},
getContent: function()
{
new Ajax.Request(this.script, {
onSuccess: function(req)
{
this.content = req.responseJSON;
//document.fire('content:retrieved', 
req.responseJSON);
}
});
$$(this.selector).invoke('observe', 'click', 
this.changeContent.bind
(this));
},
changeContent: function(event)
{
event.preventDefault();
console.log(this.content);
console.log(this.container);
/*new Effect.Fade($(this.container), { afterFinish: function() {
new Effect.Appear($(this.container));
}
});
$(this.container).update('cucu');*/
}
});
document.observe('dom:loaded', function() {
var dyn = new Dynamic(.tzNavLink a, tzContent,
titlurileZilei.php);
});

'tzContent' is the div whose content changes by clicking on of the
links with the 'tzNavLink' css class (the 1 2 3 4 5 6 links on www.ziare.ro).

The problem is that this.content is undefined in changeContent (a
function that listens for the click event), although this.container
works well in the same function. Why is that? It has something to do
with the Ajax.Request?

Also, I want to ask how can I 'tzContent' to change periodically using
such and object (I want everything to be encapsulated so I can use
this object in other projects)?

Thank you for your response.

--~--~-~--~~~---~--~~
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: Firefox v3.5

2009-08-04 Thread T.J. Crowder

Hi,

 I had similar problems - and found out that .down() or .select() fails
 when the element's id that it's fetching is starting with a number.

IDs can't start with nubmbrs.[1]  But Mona's bug report is for a valid
ID (containing a dot and/or colon, both of which are valid).  It's
been accepted on the bug list and probably fixed by now in trunk.

[1] http://www.w3.org/TR/html401/types.html#type-name
--
T.J. Crowder
tj / crowder software / com
Independent Software Engineer, consulting services available

On Aug 4, 2:46 pm, mindVex simon.sat...@googlemail.com wrote:
 I had similar problems - and found out that .down() or .select() fails
 when the element's id that it's fetching is starting with a number.

 So, $('test').down('ul, 1) failed for me, because the ul-element's id
 was something like 1_23402922. I changed it to begin with a letter
 (s_1_23402922) and it worked then.

 On Jul 29, 2:59 pm, evrim erincev...@gmail.com wrote:



  No there is not a space in ID e is expression like div.classname
  and the code adds in front of it #id  after that the expression
  is
  #id div.classname and the expression does not work in this form
  on $A(root.querySelectorAll(e)).map(Element.extend); .
  but after commented this line code work well.

  On Jul 29, 3:45 pm, Alex McAuley webmas...@thecarmarketplace.com
  wrote:

   that has a space in it no ?

   ID's are not allowed spaces

   Alex Mcauleyhttp://www.thevacancymarket.com

   - Original Message -
   From: evrim erincev...@gmail.com
   To: Prototype  script.aculo.us 
   prototype-scriptaculous@googlegroups.com
   Sent: Wednesday, July 29, 2009 12:29 PM
   Subject: [Proto-Scripty] Re: Firefox v3.5

   this change fixed only elements whose id = 0 so the new change fixed
   it well
     //e = # + id +   + e;
   I closed this row

   On Jul 29, 1:19 pm, evrim erincev...@gmail.com wrote:
I have done that change but still there is an error then,
I changed line 3339 (e = # + id +   + e;) to
if (id != 0)
e = # + id +   + e;

Now it seems working

On Jul 29, 12:00 pm, Mona Remlawi mona.reml...@gmail.com wrote:

 Must be that you're using (dot) or (colon) in your ids.
 This has been fixed, but not yet released. You can manually change in
 prototype.js line:3338 to match
 id = id.replace(/([\.:])/g, \\$1); // NOTE the $1 instead of $0

 This fix will be a part of next release as it is in the trunk [1]

 [1]http://github.com/sstephenson/prototype/blob/add69978e09653808aedec43...

 cheers

 --
 mona

 On Wed, Jul 29, 2009 at 10:54 AM, webbear1000normpo...@hotmail.com
 wrote:

  Does it work with the latest stable release?

  On Jul 29, 8:49 am, evrim erincev...@gmail.com wrote:
  Nobody has problem like that?
  Select method in your codes can run well in Firefox 3.5
--~--~-~--~~~---~--~~
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: Firefox v3.5

2009-08-04 Thread Richard Quadling

2009/8/4 mindVex simon.sat...@googlemail.com:

 I had similar problems - and found out that .down() or .select() fails
 when the element's id that it's fetching is starting with a number.

 So, $('test').down('ul, 1) failed for me, because the ul-element's id
 was something like 1_23402922. I changed it to begin with a letter
 (s_1_23402922) and it worked then.

 On Jul 29, 2:59 pm, evrim erincev...@gmail.com wrote:
 No there is not a space in ID e is expression like div.classname
 and the code adds in front of it #id  after that the expression
 is
 #id div.classname and the expression does not work in this form
 on $A(root.querySelectorAll(e)).map(Element.extend); .
 but after commented this line code work well.

 On Jul 29, 3:45 pm, Alex McAuley webmas...@thecarmarketplace.com
 wrote:

  that has a space in it no ?

  ID's are not allowed spaces

  Alex Mcauleyhttp://www.thevacancymarket.com

  - Original Message -
  From: evrim erincev...@gmail.com
  To: Prototype  script.aculo.us 
  prototype-scriptaculous@googlegroups.com
  Sent: Wednesday, July 29, 2009 12:29 PM
  Subject: [Proto-Scripty] Re: Firefox v3.5

  this change fixed only elements whose id = 0 so the new change fixed
  it well
    //e = # + id +   + e;
  I closed this row

  On Jul 29, 1:19 pm, evrim erincev...@gmail.com wrote:
   I have done that change but still there is an error then,
   I changed line 3339 (e = # + id +   + e;) to
   if (id != 0)
   e = # + id +   + e;

   Now it seems working

   On Jul 29, 12:00 pm, Mona Remlawi mona.reml...@gmail.com wrote:

Must be that you're using (dot) or (colon) in your ids.
This has been fixed, but not yet released. You can manually change in
prototype.js line:3338 to match
id = id.replace(/([\.:])/g, \\$1); // NOTE the $1 instead of $0

This fix will be a part of next release as it is in the trunk [1]

[1]http://github.com/sstephenson/prototype/blob/add69978e09653808aedec43...

cheers

--
mona

On Wed, Jul 29, 2009 at 10:54 AM, webbear1000normpo...@hotmail.com
wrote:

 Does it work with the latest stable release?

 On Jul 29, 8:49 am, evrim erincev...@gmail.com wrote:
 Nobody has problem like that?
 Select method in your codes can run well in Firefox 3.5

 


id's must start with a letter.

http://www.w3.org/TR/REC-html40/types.html#type-name


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

--~--~-~--~~~---~--~~
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: Autocompleter getSelectionId additional variables

2009-08-04 Thread mr_justin

The Autocompleter#afterUpdateElement method only passes those two
parameters, the element that the autocompleter is attached to (input)
and the selected item from the list of autocompleter values. If you
want anything else you will need to curry (or bind) them into your
callback.

...
afterUpdateElement:getSelectionId.curry(parameter1, parameter2,
parameter3)
...

function getSelectionId(param1, param2, param3, element, selected){
}

-justin
--~--~-~--~~~---~--~~
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: Class.create and this keyword

2009-08-04 Thread Matt Foster

In an effort to keep the code clean I'd delegate this functionality to
a dedicated method other than the constructor.



On Aug 4, 2:16 pm, Matt Foster mattfoste...@gmail.com wrote:
 If you really wanted to avoid bind you could just use closures within
 the initialize method

 var Sub4 = Class.create(Super4, {
         baz: bat,
         initialize: function () {
                 var self = this;
                 var f = function () {
                     alert(Class:+self.fu+self.baz);
                 };
                 document.observe(click,f);
         }

 });

 On Aug 4, 3:35 am, Cédric bertolini.ced...@gmail.com wrote:

  On 3 août, 22:38, Matt Foster mattfoste...@gmail.com wrote:

   Regardless of the JS framework.  A closure is necessary for attaching
   class methods to a particular instance and preserve the instance
   reference via the this keyword.

  This is automatic with the regular Constructor syntax. Defining a
  function as an object method inside a constructor creates a closure,
  so we can use #bind at the same time as the definition.

  The point is, Class.create acts like a prototype more than as a
  constructor. I never really thought of that. So I can't bind to my
  object instance inside Class.create. And I guess that what acts as a
  constructor in Class is the initialize method... So, maybe, I should
  define f inside initialize, something like:

  var Sub4 = Class.create(Super4, {
          baz: bat,
          initialize: function () {
                  this.f = function () {
                      alert(Class:+this.fu+this.baz);
                  }.bind(this);
                  document.observe(click, this.f);
          }

  });

  Is there a cost to operating that way? I guess I won't be able to use
  Class.addMethods...

   I thought Function.bind was pretty clean myself, but I guess you've
   got the sweet tooth for the syntax.

  I think #bind is awesome :) It's the bind the function in the
  initializer that bothers me, when I compare it to the standard syntax
  bind the function at its definition.
--~--~-~--~~~---~--~~
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: Beginners question, trouble with Event.stop in AJAX

2009-08-04 Thread Ash

Hi TJ, thanks for the help, I understand the concept of onSuccess and
have updated my javascript. That function runs without an error, but
the observe line does not some to be working (the form keeps trying to
submit using the standard old fashioned method) I think I am missing
something else fundamental.

Here is the javascript:


// Attach handler to window load event
Event.observe(window, 'load', init, false);

function init(){
 Event.observe('email-form', 'submit', callProcBasketEmail);
}


function callProcBasketEmail(e) {
var pars = Form.serialize('email-form');
var myAjax = new Ajax.Updater('email-response',
'procBasketEmail.php', {
method: 'post',
parameters: pars,
onSuccess: function(response)
{
Event.observe('password-form', 'submit',
callProcBasketPassword);
}
});
Event.stop(e);
}



function callProcBasketPassword(e) {
 var pars = Form.serialize('password-form');
 alert(pars);
 var myAjax = new Ajax.Updater('password-response',
'procBasketPassword.php', {method: 'post', parameters: pars});
 Event.stop(e);
}





and here is the HTML once the first function callProcBasketEmail(e)
has run:



form id=email-form action=# method=post
input id=email class=texterwide type=text name=email/
input id=email-submit class=button type=submit value=Submit/
/form
div id=email-response
form id=password-form action=# method=post
input id=password class=texterwide type=text name=password/
input id=password-submit class=button type=submit
value=Submit/
/form
/div
div id=password-response name=password-response/



 Thanks again in advance! :)
Ashley

On Aug 3, 5:46 pm, T.J. Crowder t...@crowdersoftware.com wrote:
 Hi,

  But this stops the whole function from working - where should the
  observe line be placed to ensure it will work properly?

 Right, because this new line:

  Event.observe('password-form', 'submit', callProcBasketPassword);

 ...will cause an error, because there is no element with the ID
 'password-form' yet.  Remember that Ajax calls are *asynchronous*
 (that's what the A in Ajax stands for).  You start the call at the
 point in your code where you create the Ajax.Updater object, but then
 your code continues immediately without waiting for the Ajax call to
 finish.  As DJ pointed out, that's what the onSuccess callback is for
 -- so you can execute code once the Ajx call has successfully
 completed.  So it would look something like this:

 http://pastie.org/569908

 In terms of getting you past these initial hurtles, some recommended
 reading:http://prototypejs.org/learn/introduction-to-ajaxhttp://proto-scripty.wikidot.com/prototype:how-to-bulletproof-ajax-re...http://prototypejs.org/api/ajax/requesthttp://prototypejs.org/api/ajax/updater

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

 On Aug 3, 2:23 pm, Ash ashley.kenner...@gmail.com wrote:

  Thanks for the help, I just tried replacing Event.stop(e); with return
  false; in the function but it still submits the form.

  I would prefer to do it the new way anyway, if you would be able to
  help me...

  The first function is called from Event.observe('email-form',
  'submit', callProcBasketEmail); which is within a function that is
  called when the document loads.

  The question is, where to put the event observe to watch the second
  form.

  My first instinct would be to put it in the function which outputs the
  form EG

  function callProcBasketEmail(e) {
   var pars = Form.serialize('email-form');
   var myAjax = new Ajax.Updater('email-response',
  'procBasketEmail.php', {method: 'post', parameters: pars});
   Event.observe('password-form', 'submit', callProcBasketPassword);
   Event.stop(e);

  }

  (line added just after the ajax function has drawn 'password-form' to
  the screen)

  But this stops the whole function from working - where should the
  observe line be placed to ensure it will work properly?

  Thanks in advance, I think once I get over these initial few hurdles
  of getting to grips with good practices, I will be fine!

  Ashley

  Here is the javascript in full:

  // Attach handler to window load event
  Event.observe(window, 'load', init, false);

  function init(){
      Event.observe('email-form', 'submit', callProcBasketEmail);

  }

  function callProcBasketEmail(e) {
   var pars = Form.serialize('email-form');
   var myAjax = new Ajax.Updater('email-response',
  'procBasketEmail.php', {method: 'post', parameters: pars});
   Event.observe('password-form', 'submit', callProcBasketPassword);
   Event.stop(e);

  }

  function callProcBasketPassword(e) {
   var pars = Form.serialize('password-form');
   alert(pars);
   var myAjax = new Ajax.Updater('password-response',
  'procBasketPassword.php', {method: 'post', parameters: pars});
   Event.stop(e);

  }

  On Aug 2, 11:19 am, T.J. Crowder t...@crowdersoftware.com wrote:

   Hi Ashley,

   In the one that's not working,