Thanks so much Alex,

I am just not sure about Element.hasClassName(el,n.id). First I tried
to have revert:changeClass follow directly after onUpdate:function(el)
{...}, but the script stopped working. So then I included
revert:changeClass inside the update function and I tried to pass
"this" to revert:changeClass, but that didn't work. If I test for
this.id in changeClass I get an undefined. Are the objects/variables
Element, o, and n predefined?

Thanks,

Nathalie

I will give it a try.

On Jun 1, 10:44 am, "Alex McAuley" <webmas...@thecarmarketplace.com>
wrote:
> First a patch is neededhttp://dev.rubyonrails.org/ticket/7396
>
> That tenery operator wont work in that situation.... you need to evaluate
> the return of the function
>
> onUpdate : function (el) {
> // do your code}
>
> revert : changeClass // function call
>
> And you change class must provide a boolean true or false.....
>
> function changeClass(el,o,n) {
>     return (Element.hasClassName( el, n.id)) ? true : false;
>
> }
>
> This should do the trick for you
>
> HTH
>
> ALex
>
> ----- Original Message -----
> From: "terry-5-" <nathaliesteinf...@gmx.net>
> To: "Prototype & script.aculo.us" <prototype-scriptaculous@googlegroups.com>
> Sent: Monday, June 01, 2009 2:58 PM
> Subject: [Proto-Scripty] Revert sortable on return value true? Possible?
>
> > Hi,
>
> > I really appreciate all you guys hard work. It has helped me in the
> > past very much and I really hope someone has encountered this problem
> > before. I tried to find a related one in this group, but had no luck.
>
> > I am trying to revert the sortable/draggable to its original place if
> > the changeClass function returns true.
> > I have problems to get a return value after an onUpdate function has
> > been succesful executed.
>
> > This is the original Sortable decleration:
>
> > Sortable.create('blank_1',{tag:'span',dropOnEmpty: true,
> > constraint:true, containment:sections, only:'lineitem',
> > onUpdate:function(el){changeClass(el);}});
>
> > And this is how I tried to check for the return value. :
>
> > Sortable.create('blank_1',{tag:'span',dropOnEmpty: true,
> > constraint:true, containment:sections, only:'lineitem',
> > onUpdate:function(el){changeClass(el);}?'lineitem'.revert:function(el)
> > {NoChange(el)};});
>
> > I am not sure how to reference the 'lineitem', if revert even is a
> > function of sortable object/class (it is not part of the
> > documentation), if I have to create a seperate Draggable to revert it,
> > or if I can have a conditional statement like the above.
>
> > My website is almost finished and only needs this little detail.
>
> > Many thanks again.
>
> > Nathalie
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to