var elm=evt.element().id; //is the id of the element no ?
----- Original Message ----- From: Yan Kovyakh To: prototype-scriptaculous@googlegroups.com Sent: Tuesday, July 21, 2009 11:27 AM Subject: [Proto-Scripty] Delete php Well yes, this does gives me a true, and in post of the remove_clone.php I see "clone 1234". But that's because you specified var e='blah_1234'; But how am I going to connect my clone:id parameter? > Here is one way to do it (though probably not the best) - but it works > var e='blah_1234'; > > var i=e.split('_'); > var l=i.length-1; > var id=(l>=1) ? i[l] : 'NULL' ; > var test=(id.length>=1) ? true : false ; > alert(test); // true means its set and has a string length greater than 1, > false means there is nothing after "_" > > then you can test it with > > if(test!==true) { > > alert('No ID Found'); > return > > } > > parameters : { clone: id } > > HTH > > ----- Original Message ----- > From: Yan Kovyakh > To: prototype-scriptaculous@googlegroups.com > Sent: Tuesday, July 21, 2009 10:00 AM > Subject: [Proto-Scripty] Delete php > > I don't really want to change the whole script, and the problem is that >I can't get the ID out, not the script. > > Is there any way to extract an ID instead of doing: > > var id = elm.id.split('_').last(); > > Because everything up to that point is working, I'm confused. > > > Ya, I'm getting an empty box, so something is wrong. > > > > Dude, firstly please stop topping the message and removing the code > and > > > >replies from your replies. > > > > secondly: try the below script and see what gets alerted (it should >be > > > >your numeric ID, if not then you have something wrong somewhere > > > > $('clones').observe('click',function(evt){ > > > > var elm = evt.element(); > > > > if (elm.hasClassName('remove')){ > > > > evt.stop(); > > > > var id = elm.id.split('_').last(); > > > > alert(id); > > > > return; > > > > new Ajax.Request('remove_clone.php',{ > > > > parameters:{clone:id}, > > > > onSuccess:function(transport){ > > > > elm.up('li').remove(); > > > > pollSortable.defer(); > > > > } > > > > }); > > > > ----- Original Message ----- > > > > From: Yan Kovyakh > > > > To: prototype-scriptaculous@googlegroups.com > > > > Sent: Monday, July 20, 2009 7:35 PM > > > > Subject: [Proto-Scripty] Delete php > > > > They actualy have Item_numericalID > > > > Is this the problem? --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---