Re: [Proto-Scripty] Issue with droppable and an element that has more than one class name

2010-04-28 Thread Guillaume Lepicard
hi, as far as i can remember, the accept option has to be in a selector syntax: try new Draggable ('draggable', {revert: 'failure', accept: '.dropme'}); or Droppables.add(audience-element-0, {accept: '.Social', onDrop: this.dropElement}); On Tue, Apr 27, 2010 at 10:47 PM, Jangla wrote: > If I ha

[Proto-Scripty] Re: script.aculo.us autocomplete on dynamically added form field?

2010-04-28 Thread Jean-Philippe Encausse
Hi, I have the same kind of issue: 1. I have an .. 2. I create an Autocompleter on this INPUT 3. I do $(li).clone(true); 4. I create an Autocompleter on this INPUT It works well on Firefox but it is broken on IE6. The 1st Autocompleter is called on the 2nd Input. Workaround: $(inut).stopObser

[Proto-Scripty] Adding new objects from old objects

2010-04-28 Thread Jangla
Here's some castly cimplified code of what I'm trying to do: var myClass = Class.create({ initialize : function() { this.id = 0; this.type = 'Undefined'; this.assignedAudienceTypes = []; this.title = 'Untitled'; this.add(); return this; }, add : function(renderTo) {

Re: [Proto-Scripty] Adding new objects from old objects

2010-04-28 Thread Guillaume Lepicard
hi, when you observe Event.observe('button-' + this.id, 'click', this.add); a new anonymous add fucntion is created. To be sure it will be binded to this, Event.observe('button-' + this.id, 'click', this.add.bindAsEventListener(this)); On Wed, Apr 28, 2010 at 1:53 PM, Jangla wrote: > Here's so

[Proto-Scripty] Re: Adding new objects from old objects

2010-04-28 Thread Jangla
Actually, to better pose my question, how can I create an object that contains an HTML element with an event listener that adds a new instance of the same object to the page (and with an incremented id)? Should I be adding the event listener from outside the object entirely? Or am I close but not

[Proto-Scripty] Re: How would I get a closer set of siblings?

2010-04-28 Thread Matt Foster
This would be an ideal use case for XPath. On Mar 5, 10:35 am, Walter Lee Davis wrote: > Thanks, yes that might work. But I am trying to write something which   > is structure-agnostic, since it goes in a plug-in for a Web design   > application, and I have no idea how people will want to use i

Re: [Proto-Scripty] Re: Adding new objects from old objects

2010-04-28 Thread Walter Lee Davis
Whenever adding an event listener to an object you are adding to the page after load, consider using the event delegation pattern. Observe the container into which you are adding this new object rather than the object itself, and then use Event.element() to get a handle to the actual creato

Re: [Proto-Scripty] Re: Adding new objects from old objects

2010-04-28 Thread Walter Lee Davis
Forgot to add -- this means that you could have one or twenty-one items inside of #foo, add some more, delete some, it doesn't matter. One handler will manage all of them, and in my example, bar == trigger n, no matter which trigger you clicked on, as long as you provide a little bit of sug

[Proto-Scripty] Re: Adding new objects from old objects

2010-04-28 Thread Jangla
Walter, that's really really helpful - thanks! I'm going to have a look at it some more, play with it and see what I can come up with. You may have even helped with other issues I've been having with a similar piece of code in the same app but I'll let you know on that one ;) On Apr 28, 4:21 pm, W

[Proto-Scripty] Why doesn't Sortables have an accept param?

2010-04-28 Thread Jangla
Here's the scenario: div.one div.one div.two div.two div.three div.three div#droparea I need to be able to drop only elements of class 'one' into the drop area and once they're in there they need to be sortable. For some reason, the Droppables object that Sortable creates doesn't have the accept

[Proto-Scripty] Re: Issue with droppable and an element that has more than one class name

2010-04-28 Thread Jangla
Don't think so - just tried it and now nothing drops :) Basically the problem is that I start with a droppable that will accept anything and only once one element has been dropped on does the accept have to change so only elements of that same class can be dropped in future. So this for the initi

[Proto-Scripty] Re: Issue with droppable and an element that has more than one class name

2010-04-28 Thread Jangla
In fact, here's the code for a really simple example. What *should* happen is that you should be able to drop the first text onto the second text and it should stay there. Not so though: drag me drop here Droppables.add ('droppable', {accept: 'dropme'}); new Draggable ('draggable', {revert: 'fa