[Proto-Scripty] Re: Sortable.create and onHover
Ok, thanks, but how would you implement my code then? Do I have to overload the whole Sortable.onHover method? If yes, then every new Sortable created will call the onHover method isn't it? I would like it to be called only for this Sortable, not all of them. Thanks for your help, Seb On Aug 9, 8:17 pm, mr_justin gro...@jperkins.otherinbox.com wrote: what I want to do is pass the onHover to the created Droppables. But it already does that. See dragdrop.js for this code in the Sortable#create method: // build options for the droppables var options_for_droppable = { overlap: options.overlap, containment: options.containment, tree: options.tree, hoverclass: options.hoverclass, onHover: Sortable.onHover // -- Here is where it happens }; --~--~-~--~~~---~--~~ 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: dom:loaded exceptions
2009/8/7 nlloyds nllo...@gmail.com: On Aug 6, 4:32 pm, mr_justin gro...@jperkins.otherinbox.com wrote: Don't call a method on an element unless it exists. This is a basic defensive coding technique. He gets this. His question is about why he does not receive an exception. I'm not sure, and now that I think about it, I may have had the same problem. Nicolas, have you tried your example with the latest RC of Prototype? I've just tried with 1.6.1 RC3 and the behavior is the same. Should I open a ticket or discuss about this bug on the core 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] how to select multiple entries from a auto complete box?
Hi, I have an auto complete box which is populated with the list of users of the application. It is working fine with the box listing the users. But I am able to select only one user. How to select multiple users from the list ? I am using the built-in auto complete feature of the CakePHP framework. But in order to select multiple entries, I think I must code the js separately, since the ajax helper in CakePHP does not support selecting multiple entries. This is the action in the controller which generates the auto complete text box. function autoComplete() { $this-set('users',$this-User-find('all',array( 'fields'=array ('User.id','User.name'), 'conditions'=array('User.name LIKE' = $this-data['User'] ['name'].'%'; $this-layout = ajax; } This is the auto_complete.ctp file ul ?php foreach($users as $user): ? li?php echo $user['User']['name']; ?/li ?php endforeach; ? /ul And this is the view where I have the auto complete box: ?php echo $form-create('User', array('url' = '/forms/share')); ? ?php echo $ajax-autoComplete('User.name', '/forms/ autoComplete');? ?php echo $form-end('Share');? In the auto complete box, I am able to select only one user name. how can I select multiple users with a comma or space separator? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To post to this group, send email to prototype-scriptaculous@googlegroups.com To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en -~--~~~~--~~--~--~---
[Proto-Scripty] [Prototype] Encounter a bug in endsWith ?
Hello, I don't know why but : input = 'prototypes' bool = input.endsWith('n'); bool = bool || input.endsWith('s'); alert(bool); works fine but : alert(input.endsWith('n') || input.endsWith('s')); return me an error (IE6) What I've do wrong? 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] Broken Link to Autocompleter on the Script.aculo.us
Does anyone have a working link to a demo page of the autocompleter? The ones on github and on scriptaculous are broken. --~--~-~--~~~---~--~~ 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] Getting keys from a JSON object returned from transport.responseText.evalJSON(); or for that matter any JSON object
I tried to google and search prototype API for a method that will give me just the keys in a JSON object. Is there none in Prototype and no way to know the keys? Regards Krishna --~--~-~--~~~---~--~~ 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: Getting keys from a JSON object returned from transport.responseText.evalJSON(); or for that matter any JSON object
Hi, Regardless of where the object came from (having evaluated it from a JSON string or something else), that's what for..in is for: var name, obj = {'a': 1, 'b': 2}.evalJSON(); for (name in obj) { alert(name + = + obj[name]); } ...alerts a=1 then b=2. The order is not guaranteed. Cool, eh? Speaking generally, for..in iterates through the names of the properties in the object. Note that depending on the object in question, some of those properties may refer to functions: var obj = { foo: function() { alert(Foo!); }, bar: 42 }; var name; for (name in obj) { alert(typeof obj[ + name + ] = + typeof obj[name]); } ...alerts obj[foo] = function and obj[bar] = number. for..in includes properties an object has inherited from its prototype: var a = ['one', 'two']; var name; for (name in a) { alert(typeof a[ + name + ] = + typeof a[name]); } ...will not only alert a[0] =one and a[1] = 2 but also any other enumerable properties on arrays. In most implementations, there aren't any other *enumerable* properties (some properties can be marked dontEnum, but only by the implementation, not our code), but when you're using Prototype, there are lots -- because Prototype adds lots of properties to the Array prototype referencing additional nifty Array functions. Which is why you don't use for..in to loop through array elements, there could be more than just the array elements.[1] You can filter out the properties that are inherited from the prototype by using hasOwnProperty: var a = ['one', 'two']; var name; for (name in a) { if (a.hasOwnProperty(name)) { alert(typeof a[ + name + ] = + typeof a[name]); } } ...will only alert the two you expect. All of the above is JavaScript, not Prototype; details in the spec[2]. [1] http://proto-scripty.wikidot.com/prototype:tip-looping-through-arrays [2] http://www.ecma-international.org/publications/standards/Ecma-262.htm HTH, have fun! -- T.J. Crowder tj / crowder software / com Independent Software Engineer, consulting services available On Aug 10, 2:54 pm, krishna81m krishna...@gmail.com wrote: I tried to google and search prototype API for a method that will give me just the keys in a JSON object. Is there none in Prototype and no way to know the keys? Regards Krishna --~--~-~--~~~---~--~~ 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: Getting keys from a JSON object returned from transport.responseText.evalJSON(); or for that matter any JSON object
You can prolly sort the order if you wanted it in some kind of order but its not needed in my opinion! Alex Mcauley http://www.thevacancymarket.com - Original Message - From: T.J. Crowder t...@crowdersoftware.com To: Prototype script.aculo.us prototype-scriptaculous@googlegroups.com Sent: Monday, August 10, 2009 3:37 PM Subject: [Proto-Scripty] Re: Getting keys from a JSON object returned from transport.responseText.evalJSON(); or for that matter any JSON object Hi, Regardless of where the object came from (having evaluated it from a JSON string or something else), that's what for..in is for: var name, obj = {'a': 1, 'b': 2}.evalJSON(); for (name in obj) { alert(name + = + obj[name]); } ...alerts a=1 then b=2. The order is not guaranteed. Cool, eh? Speaking generally, for..in iterates through the names of the properties in the object. Note that depending on the object in question, some of those properties may refer to functions: var obj = { foo: function() { alert(Foo!); }, bar: 42 }; var name; for (name in obj) { alert(typeof obj[ + name + ] = + typeof obj[name]); } ...alerts obj[foo] = function and obj[bar] = number. for..in includes properties an object has inherited from its prototype: var a = ['one', 'two']; var name; for (name in a) { alert(typeof a[ + name + ] = + typeof a[name]); } ...will not only alert a[0] =one and a[1] = 2 but also any other enumerable properties on arrays. In most implementations, there aren't any other *enumerable* properties (some properties can be marked dontEnum, but only by the implementation, not our code), but when you're using Prototype, there are lots -- because Prototype adds lots of properties to the Array prototype referencing additional nifty Array functions. Which is why you don't use for..in to loop through array elements, there could be more than just the array elements.[1] You can filter out the properties that are inherited from the prototype by using hasOwnProperty: var a = ['one', 'two']; var name; for (name in a) { if (a.hasOwnProperty(name)) { alert(typeof a[ + name + ] = + typeof a[name]); } } ...will only alert the two you expect. All of the above is JavaScript, not Prototype; details in the spec[2]. [1] http://proto-scripty.wikidot.com/prototype:tip-looping-through-arrays [2] http://www.ecma-international.org/publications/standards/Ecma-262.htm HTH, have fun! -- T.J. Crowder tj / crowder software / com Independent Software Engineer, consulting services available On Aug 10, 2:54 pm, krishna81m krishna...@gmail.com wrote: I tried to google and search prototype API for a method that will give me just the keys in a JSON object. Is there none in Prototype and no way to know the keys? Regards Krishna --~--~-~--~~~---~--~~ 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: Many warnings
Hi, Sounds like you have some kind of JavaScript lint plug-in installed (or I think there's also a mode of Firefox that will do that). It's not out-of-the-box behavior. These tools aim to help you find *possible* errors in your code, but can also flag up things which are perfectly valid though they may look like coding errors. I'd suggest finding the plug-in (add-on) or setting that's doing this and turning it off if you don't care for it. Specifically, what the lint tool is complaining about is something like this: For instance: function foo(bar) { if (bar) { return bar * 2; } } Although I would strongly recommend you didn't code things this way, it's perfectly legal JavaScript whereas in many languages that wouldn't be valid syntax because ...not all code paths return a value. In that example, foo only returns a value if 'bar' is truthy. In JavaScript, if a function doesn't return a value, the expression calling it takes the value undefined as though the function had returned undefined. So here: var x = foo(false); ...x is undefined, whereas here: var x = foo(1); x is 2. For all practical intents and purposes, you can read a function that doesn't explicitly return anything as having an implicit return undefined. (Although technically the spec draws a distinction between the two situations, in practical terms, it's a distinction without a difference.) Prototype has several functions that these lint tools would look at a bit askance; this is a fairly common Prototype pattern: function someNiftyElementFunction(element) { element = $(element); if (!element) return; // ...nifty stuff here... return element; } Again, technically only one of those code paths has a return value, although in practice it's as though the return; were return undefined;, and in any case it's valid syntax, just the kind of thing that *looks* like it might be a programmer error. HTH, -- T.J. Crowder tj / crowder software / com Independent Software Engineer, consulting services available On Aug 10, 12:19 pm, panoramix jackson92...@gmail.com wrote: Hi, I try prototype.js tout retrieve the browser type with if (Prototype.Browser.IE) and so on and when i load this page with Firefox, i recieve many warnings ex: Warning: anonymous function does not always return a value Line: 130, Column: 45 Source Code: case 'boolean': return object.toString(); Warning: anonymous function does not always return a value Line: 133, Column: 32 Source Code: if (object === null) return 'null'; Warning: test for equality (==) mistyped as assignment (=)? Line: 348, Column: 39 Source Code: if (match = source.match(pattern)) { I don't know if is very important but for your information thank's panoramix --~--~-~--~~~---~--~~ 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: help with select on element not working
Thanks so much T.J., that was the problem. I never would have gotten that Maurice --~--~-~--~~~---~--~~ 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: Drag and drop slow on IE (many droppables)
I am also struggling with the same problem. Do you have any success with it? if yes, please do share it. On Jun 21, 10:47 pm, david david.brill...@gmail.com wrote: Hi fat bold cyclop, to retriev the X/Y position of an element, go and have a look athttp://prototypejs.org/api/element/cumulativeoffsetandhttp://prototypejs.org/api/element/cumulativescrolloffsetdepending if there is scroll or not. Both return coordonate of the element, Then you just need to verify with mouse position wich could be retirvr from event. -- david On 20 juin, 08:20, fat bold cyclop fat.bold.cyc...@gmail.com wrote: I try to make dnd for pieces on Shogi board. My approach is: when a user starts to drag a piece, I make these fields on the board that the piece can move to droppable. Shogi board is 9x9 DIVs structure so there could be about 81 droppables. Dragged element is an IMG. I made an example with 76 droppables (http://shogitools.appspot.com/ html/asb_example1.html - when you drag the piece beside the board). The code works well on FireFox, Safari, Opera and Chrome, but on Internet Explorer it works veeery slow. (when there are less dropables - when you drag the pieces that are on the board - the performance is quite decent) I don't know if its my code, scriptaculous' or evil IE. It's probably subject for another post. What I want now is some workaround. I thought I make one big DIV (covering the whole board) as a droppable and then when the piece is dropped I would get it's position relative to the DIV. This way I would know on which field the piece should be put. Could anyone please suggest me, how to get the 'drop-positon'? Is such an information stored in event? Thanks in advance, fat bold cyclop- Hide quoted text - - Show quoted text - --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To post to this group, send email to prototype-scriptaculous@googlegroups.com To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en -~--~~~~--~~--~--~---
[Proto-Scripty] Re: Encounter a bug in endsWith ?
Hi, If I assume 'input' is defined in the second example (you show it defined in the first example but not the second), I'm not seeing an error. Can you produce a small, self-contained example[1] of the problem? [1] http://proto-scripty.wikidot.com/self-contained-test-page FWIW, -- T.J. Crowder tj / crowder software / com Independent Software Engineer, consulting services available On Aug 10, 11:08 am, Arnaud F. arnaud.fe...@gmail.com wrote: Hello, I don't know why but : input = 'prototypes' bool = input.endsWith('n'); bool = bool || input.endsWith('s'); alert(bool); works fine but : alert(input.endsWith('n') || input.endsWith('s')); return me an error (IE6) What I've do wrong? 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: Getting keys from a JSON object returned from transport.responseText.evalJSON(); or for that matter any JSON object
var keys = $H(obj).keys(); http://prototypejs.org/api/hash/keys -- http://positionabsolute.net On Aug 10, 10:46 am, Alex McAuley webmas...@thecarmarketplace.com wrote: You can prolly sort the order if you wanted it in some kind of order but its not needed in my opinion! Alex Mcauleyhttp://www.thevacancymarket.com - Original Message - From: T.J. Crowder t...@crowdersoftware.com To: Prototype script.aculo.us prototype-scriptaculous@googlegroups.com Sent: Monday, August 10, 2009 3:37 PM Subject: [Proto-Scripty] Re: Getting keys from a JSON object returned from transport.responseText.evalJSON(); or for that matter any JSON object Hi, Regardless of where the object came from (having evaluated it from a JSON string or something else), that's what for..in is for: var name, obj = {'a': 1, 'b': 2}.evalJSON(); for (name in obj) { alert(name + = + obj[name]); } ...alerts a=1 then b=2. The order is not guaranteed. Cool, eh? Speaking generally, for..in iterates through the names of the properties in the object. Note that depending on the object in question, some of those properties may refer to functions: var obj = { foo: function() { alert(Foo!); }, bar: 42 }; var name; for (name in obj) { alert(typeof obj[ + name + ] = + typeof obj[name]); } ...alerts obj[foo] = function and obj[bar] = number. for..in includes properties an object has inherited from its prototype: var a = ['one', 'two']; var name; for (name in a) { alert(typeof a[ + name + ] = + typeof a[name]); } ...will not only alert a[0] =one and a[1] = 2 but also any other enumerable properties on arrays. In most implementations, there aren't any other *enumerable* properties (some properties can be marked dontEnum, but only by the implementation, not our code), but when you're using Prototype, there are lots -- because Prototype adds lots of properties to the Array prototype referencing additional nifty Array functions. Which is why you don't use for..in to loop through array elements, there could be more than just the array elements.[1] You can filter out the properties that are inherited from the prototype by using hasOwnProperty: var a = ['one', 'two']; var name; for (name in a) { if (a.hasOwnProperty(name)) { alert(typeof a[ + name + ] = + typeof a[name]); } } ...will only alert the two you expect. All of the above is JavaScript, not Prototype; details in the spec[2]. [1]http://proto-scripty.wikidot.com/prototype:tip-looping-through-arrays [2]http://www.ecma-international.org/publications/standards/Ecma-262.htm HTH, have fun! -- T.J. Crowder tj / crowder software / com Independent Software Engineer, consulting services available On Aug 10, 2:54 pm, krishna81m krishna...@gmail.com wrote: I tried to google and search prototype API for a method that will give me just the keys in a JSON object. Is there none in Prototype and no way to know the keys? Regards Krishna --~--~-~--~~~---~--~~ 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: how to select multiple entries from a auto complete box?
If you use the script.aculo.us autocompleter the option you need to set is called tokens which takes either a string or an array of strings to reset on. Note: I haven't used autocompleter myself just looked up the info. On Mon, Aug 10, 2009 at 4:11 AM, Angelinemailangel...@gmail.com wrote: Hi, I have an auto complete box which is populated with the list of users of the application. It is working fine with the box listing the users. But I am able to select only one user. How to select multiple users from the list ? I am using the built-in auto complete feature of the CakePHP framework. But in order to select multiple entries, I think I must code the js separately, since the ajax helper in CakePHP does not support selecting multiple entries. This is the action in the controller which generates the auto complete text box. function autoComplete() { $this-set('users',$this-User-find('all',array( 'fields'=array ('User.id','User.name'), 'conditions'=array('User.name LIKE' = $this-data['User'] ['name'].'%'; $this-layout = ajax; } This is the auto_complete.ctp file ul ?php foreach($users as $user): ? li?php echo $user['User']['name']; ?/li ?php endforeach; ? /ul And this is the view where I have the auto complete box: ?php echo $form-create('User', array('url' = '/forms/share')); ? ?php echo $ajax-autoComplete('User.name', '/forms/ autoComplete');? ?php echo $form-end('Share');? In the auto complete box, I am able to select only one user name. how can I select multiple users with a comma or space separator? --~--~-~--~~~---~--~~ 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: Getting keys from a JSON object returned from transport.responseText.evalJSON(); or for that matter any JSON object
I do know about the for(var key in jsonObj) { jsonObj[key]; } On Mon, Aug 10, 2009 at 9:54 AM, krishna81m krishna...@gmail.com wrote: I tried to google and search prototype API for a method that will give me just the keys in a JSON object. Is there none in Prototype and no way to know the keys? Regards Krishna --~--~-~--~~~---~--~~ 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: Getting keys from a JSON object returned from transport.responseText.evalJSON(); or for that matter any JSON object
Matt foster wrote. var keys = $H(obj).keys(); http://prototypejs.org/api/hash/keys -- http://positionabsolute.net Alex Mcauley http://www.thevacancymarket.com - Original Message - From: ra kr To: Prototype script.aculo.us Sent: Monday, August 10, 2009 5:01 PM Subject: [Proto-Scripty] Re: Getting keys from a JSON object returned from transport.responseText.evalJSON(); or for that matter any JSON object I do know about the for(var key in jsonObj) { jsonObj[key]; } On Mon, Aug 10, 2009 at 9:54 AM, krishna81m krishna...@gmail.com wrote: I tried to google and search prototype API for a method that will give me just the keys in a JSON object. Is there none in Prototype and no way to know the keys? Regards Krishna --~--~-~--~~~---~--~~ 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: dom:loaded exceptions
I'm correctly seeing ann exception thrown in: Safari 4.0.2 FF 3.0.13 However, it's no longer the case in FF 3.5.1. It seems that the issue isn't related to the dom:loaded event in particular, but to any fired custom event. Here's a reduced testcase: html head script type=text/javascript src=http:// prototypejs.org/assets/2009/6/16/prototype.js/script script type=text/javascript document.observe('foo:bar', function() { throw 'foo' }); document.fire('foo:bar'); /script /head body /body /html Please open a bug report. Thanks, Tobie On Aug 10, 11:15 am, Nicolas Terray nicolas.ter...@gmail.com wrote: 2009/8/7 nlloyds nllo...@gmail.com: On Aug 6, 4:32 pm, mr_justin gro...@jperkins.otherinbox.com wrote: Don't call a method on an element unless it exists. This is a basic defensive coding technique. He gets this. His question is about why he does not receive an exception. I'm not sure, and now that I think about it, I may have had the same problem. Nicolas, have you tried your example with the latest RC of Prototype? I've just tried with 1.6.1 RC3 and the behavior is the same. Should I open a ticket or discuss about this bug on the core 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: dom:loaded exceptions
This is definitely a FF issue. Here's a reduced testcase without Prototype: html head script type=text/javascript document.addEventListener('click', function() { throw 'foo' }, false); var event = document.createEvent('MouseEvents'); event.initEvent('click', true, true); document.documentElement.dispatchEvent(event); /script /head body /body /html This should throw an error but doesn't in FF 3.5.1 On Aug 10, 6:30 pm, Tobie Langel tobie.lan...@gmail.com wrote: I'm correctly seeing ann exception thrown in: Safari 4.0.2 FF 3.0.13 However, it's no longer the case in FF 3.5.1. It seems that the issue isn't related to the dom:loaded event in particular, but to any fired custom event. Here's a reduced testcase: html head script type=text/javascript src=http:// prototypejs.org/assets/2009/6/16/prototype.js/script script type=text/javascript document.observe('foo:bar', function() { throw 'foo' }); document.fire('foo:bar'); /script /head body /body /html Please open a bug report. Thanks, Tobie On Aug 10, 11:15 am, Nicolas Terray nicolas.ter...@gmail.com wrote: 2009/8/7 nlloyds nllo...@gmail.com: On Aug 6, 4:32 pm, mr_justin gro...@jperkins.otherinbox.com wrote: Don't call a method on an element unless it exists. This is a basic defensive coding technique. He gets this. His question is about why he does not receive an exception. I'm not sure, and now that I think about it, I may have had the same problem. Nicolas, have you tried your example with the latest RC of Prototype? I've just tried with 1.6.1 RC3 and the behavior is the same. Should I open a ticket or discuss about this bug on the core 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: Getting keys from a JSON object returned from transport.responseText.evalJSON(); or for that matter any JSON object
Awesome, thanks guys, for such a quick response!!! On Aug 10, 12:15 pm, Alex McAuley webmas...@thecarmarketplace.com wrote: Matt foster wrote. var keys = $H(obj).keys(); http://prototypejs.org/api/hash/keys -- http://positionabsolute.net Alex Mcauleyhttp://www.thevacancymarket.com - Original Message - From: ra kr To: Prototype script.aculo.us Sent: Monday, August 10, 2009 5:01 PM Subject: [Proto-Scripty] Re: Getting keys from a JSON object returned from transport.responseText.evalJSON(); or for that matter any JSON object I do know about the for(var key in jsonObj) { jsonObj[key]; } On Mon, Aug 10, 2009 at 9:54 AM, krishna81m krishna...@gmail.com wrote: I tried to google and search prototype API for a method that will give me just the keys in a JSON object. Is there none in Prototype and no way to know the keys? Regards Krishna --~--~-~--~~~---~--~~ 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: Getting keys from a JSON object returned from transport.responseText.evalJSON(); or for that matter any JSON object
What about simply: Object.keys(myObj)? http://prototypejs.org/api/object/keys --~--~-~--~~~---~--~~ 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: dom:loaded exceptions
Relevant FF bug report: https://bugzilla.mozilla.org/show_bug.cgi?id=503244 --~--~-~--~~~---~--~~ 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: Broken Link to Autocompleter on the Script.aculo.us
check this message: http://groups.google.com/group/prototype-scriptaculous/browse_thread/thread/aef9f81930e5c999?hl=en# I guess it's never working. On Mon, Aug 10, 2009 at 6:09 AM, CoolAJ86coola...@gmail.com wrote: Does anyone have a working link to a demo page of the autocompleter? The ones on github and on scriptaculous are broken. --~--~-~--~~~---~--~~ 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: Broken Link to Autocompleter on the Script.aculo.us
and this message: http://groups.google.com/group/prototype-scriptaculous/browse_thread/thread/62497102586a0457?hl=en# It seems that the person who answered my questions, actually never tried to open the link. And it seems that nobody else really cares, :( On Mon, Aug 10, 2009 at 10:53 AM, G. Sharon Yangokghy...@gmail.com wrote: check this message: http://groups.google.com/group/prototype-scriptaculous/browse_thread/thread/aef9f81930e5c999?hl=en# I guess it's never working. On Mon, Aug 10, 2009 at 6:09 AM, CoolAJ86coola...@gmail.com wrote: Does anyone have a working link to a demo page of the autocompleter? The ones on github and on scriptaculous are broken. --~--~-~--~~~---~--~~ 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] Making a Draggable-pool
Hi, is it possible to make a draggable be dragged unlimited times from one Position? I want to make some kind of Item pool that can be dragged multiple times... --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To post to this group, send email to prototype-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: Making a Draggable-pool
Not sure I understand what you are wanting to do. If you mean drag from one location and the pop back so it can be dragged again, then yes you have full control over what happens during and after drags. Look in the documentation for the various callbacks you have available. On 8/10/09, Drr cran...@web.de wrote: Hi, is it possible to make a draggable be dragged unlimited times from one Position? I want to make some kind of Item pool that can be dragged multiple times... -- Sent from my mobile device --~--~-~--~~~---~--~~ 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: Making a Draggable-pool
Look @ the ghost option Alex Mcauley http://www.thevacancymarket.com - Original Message - From: Drr cran...@web.de To: Prototype script.aculo.us prototype-scriptaculous@googlegroups.com Sent: Monday, August 10, 2009 7:06 PM Subject: [Proto-Scripty] Making a Draggable-pool Hi, is it possible to make a draggable be dragged unlimited times from one Position? I want to make some kind of Item pool that can be dragged multiple times... --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To post to this group, send email to prototype-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: Getting keys from a JSON object returned from transport.responseText.evalJSON(); or for that matter any JSON object
Yep, that's exactly what I found after even more googling!! On Aug 10, 12:55 pm, Tobie Langel tobie.lan...@gmail.com wrote: What about simply: Object.keys(myObj)? http://prototypejs.org/api/object/keys --~--~-~--~~~---~--~~ 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 compatibility issue with prototype 1.6 version
Hi All, I am using the prototype version 1.6 framework with lightview api. I having issue with IE 8, but the same code is working fine in FireFox. Error : Line 1928, Invalid argument. Can someone please help me to solve this issue? Thanks in Advance Regards Karamjit --~--~-~--~~~---~--~~ 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] Using custom onDrop effect works perfect in FF, breaks in IE
the following code seems to work fine in Firefox, allowing me to drag and drop an item, then pick it up a second later and drop it to a new area. However in IE, it completely breaks down. The next 21 (or so) times I mouse up (only on mouseup, mouse down does not do it, and I can mouse down on one div, move to another to mouseup and it will create a duplicate on the mouseuped div), a copy of the draggable appears in whatever droppable my mouse is over. Once it's done with that silliness, all my draggables are broken and do not drag. function DropHandler(element,el){ var newnode = document.createElement('img'); var classname = element.className; newnode.src=img/+element.id+.jpg; $(el).appendChild(newnode); newnode.setAttribute(class, classname); newnode.setAttribute(className, classname); $(element.id).parentNode.removeChild($(element.id)); newnode.setAttribute('id', element.id); new Draggable(newnode.id,{revert:true}); } --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To post to this group, send email to prototype-scriptaculous@googlegroups.com To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en -~--~~~~--~~--~--~---
[Proto-Scripty] Usage of AJAX responder to monitor AJAX calls and call custom javascript on AJAX call completion
draft: I am trying to achieve a way to make calls to an AJAXMethod() and return the response without using an onSuccess: callerMethod() logic. In the following piece of code, var jsonObjects; function AJAXcallerMethod() { var jsonObj = AJAXMethod(); } function AJAXMethod() { new Ajax.Request(url, { method: 'get', onSuccess: function(transport){ jsonObjects = transport.responseText.evalJSON(); } } return jsonObjects; } this will not work as the AJAX calls are asynchronous, that the jsonObjects is returned, probably, even before the call is actually made and the value jsonObjects is updated later! One way to avoid this problem is to have multiple methods, for example function AJAXcallerMethod() { AJAXMethod(); } function AJAXMethod(url) { new Ajax.Request(url, { method: 'get', onSuccess:AJAXprocessMethod, onFailure: function() { alert(could not make the AJAX call); } } }); } function AJAXprocessMethod(transport) { var jsonObjects = transport.responseText.evalJSON(); // do whatever you want to with the jsonObjects array } However, I cannot have three methods for one AJAX call and also I have one standard method, that I wrote to essentially RE-USE, to automatically update the corresponding table and form fields based on the keys passed form the server-side on the page without a page refresh using prototype. In this method updateFormAndTableWithJSONresponse(...) that I call from the AJAXcallerMethod(), the method is able to successfully update form and tables as per my requirement, however, I want to monitor this method and continue when this method ends, because any of the custom AJAXcallerMethod() that calls this method has logic that needs to be run ONLY after this method is finished, but I am not sure how I achieve this, that is wait until this method is finished and continue with the custom javascript code? I have heard something similar to AJAX responders that can help me here, but again, there will be three methods for each call, instead I want to re-use this method and also continue with my custom javascript code ONLY after the method call ends. How can I use AJAX responder to achieve this? function updateFormAndTableWithJSONresponse(formId, actionName, actionMethod, refTableId, throwErrorIfNotFound) { var contextPath = document.forms[0].contextPath.value; if(contextPath == null || contextPath == '') { alert('could not find the hidden contextPath property in the form'); return false; } var url = contextPath + '/' + actionName + .do?method= + actionMethod + ; // collect all the field values associated with this form whose id is 'ajaxFormId' // and attach it to do a get(), isn't there a way to attach all form fields in post // automatically like we do in a normal HTTPRequest doPost()? url = url + Form.serialize($(formId)); // I mean we may be imposing a limitation of 3kb in doGet() // Create the XMLHttpRequest object and send it via the Ajax.Request prototype.js method new Ajax.Request(url, { method: 'get', onSuccess: function(transport){ var jsonObjects = transport.responseText.evalJSON(); // If it is not an array (default return tyep), it must be an individual jsonObject // that contains error message if(jsonObjects == null) // also check for type as object { if(throwErrorIfNotFound) alert('could not get a JSON response '); return; } if(jsonObjects.length === undefined) { if(!(jsonObjects['errorMessage'] === undefined)) { var errMsgDiv = $('errMsg'); errMsgDiv.style.display = 'block'; errMsgDiv.innerHTML = jsonObjects['errorMessage']; } } else { var jsonObjIndex = 0; // use reference table to update contentTable only when refTableId is not null if(refTableId != null refTableId != '') { // tableRowContent is an array where each row represents the table row in the form // of a jsonObjects var tableRowContent
[Proto-Scripty] draggable containers
Hi, I need to divide a web page into two columns. Each column will have one or more tables. In those tables there might be links. I would like to be able to drag each column so that they can be swapped or moved around with their content [something a bit similar to igoogle]. Is this something that can be done with script.aculo.us? Any links/ references would be appreciated. Thanks zef --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---