I don''t follow your code. objectURL is fixed and does not vary from
object-to-object. Why would you even need to use it; just put it in
the code. I also don''t know what the ''projects''
object is since it''s
not referenced anywhere else.
That said, if you were to have some sort of per-object URL, the first
parameter passed to the onDrop callback is the object being dropped.
Something like this will work:
Dropptables.add(''details'', {
accept: ''object'',
onDrop: function(el) {
window.open(el.id + ''.htm'');
}
});
On 5/27/07, Tim <tim.einfeldt-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org>
wrote:>
> hi,
>
> i have created a set of dragable objects and a dropable container for
> these objects with scriptaculous.
>
> when one of the objects is dropped onto the container, a new site with
> information about that object should be opened (via
> window.open(objectURL,''_self'')).
>
> the drag&drop mechanism itself works good, but how do i pass a
> variable from the dragable for my ''objectURL''?
> the objects have unique IDs.
>
> here is the sourcecode, maybe it helps to clarify my problem.
>
> //start sourcecode
>
> //define dragables
> var objects = document.getElementsByClassName(''objects'');
> for (var i = 0; i < objects.length; i++) {
> new Draggable(objects[i].id, {ghosting:true, revert:true})
> }
>
> //this is the line in question. how can i pass the ID of the dragged
> object to use it in my objectURL variable?
> var objectURL = $(projects).id+''.htm''
>
> //define dropable
> Droppables.add(''details'', {
> accept: ''objects'',
> onDrop: function(showDetails)
> { window.open(objectURL,''_self'') }});
>
>
> //end sourcecode
>
>
> i hope i could more or less make clear what my question is, im really
> looking forward to answers from more skilled people.
>
> thanks a lot in advance,
>
> tim.
>
>
> >
>
--
Jesse E.I. Farmer
e: jesse-h8Qh2m8E5SHQT0dZR+AlfA@public.gmane.org
w: http://20bits.com
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Spinoffs" group.
To post to this group, send email to
rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---