I've been using PrototypeJS recently for a project, but today I've encountered an issue.
I'm doing some kind of contact list for a module, where we can add a contact via a form, or suppress it with a link.
Here is my HTML for the removing link :
<td>
<a href="#" id="rmContact" name="<?php echo $contact->ID; ?>">
<img src="../profil_collab/themes/collab_fr/images/supprime.gif" border="0">
</a>
</td>
There is one link for each contact in the list.
And here is the AJAX I created for this:
Event.observe( $('rmContact'), 'click', function(event) {
var suppress = new Ajax.Request('annuaire_rm_contact.php', {
parameters:
{
ref_contact: ref,
id: this.readAttribute("name")
},
onSuccess: function() {
formdiv.setStyle({
display: 'none'
});
var ajaxCall = new Ajax.Updater("list", "annuaire_contact_list.php", {
parameters: { ref: ref}
}
);
div.setStyle({
display: 'initial'
});
}
});
Event.stop(event);
});
But there is an issue here: I can remove only the first element of the list. Also, I can't remove after the updater has been called. If I want to, I have to refresh the page.
Well I've tried everything, so if someone have an idea it would be really great :).