I am writing a custom module that is using community_tag as a base and then adds additional data to a custom table when a term is submitted or deleted with the community_tag ajax UI . I have my module working with jQuery and ajax requests, is there any way around using jQuery and ajax? Could I listen to a submit call in hook_form_alter to submit my additional information? Thanks for providing such a great module.

Comments

nsuit’s picture

Status: Active » Closed (fixed)
Issue tags: +behaviors, +community tags, +delete tags

If my first post was confusing : I was just wondering how I can add some extra actions when a Community_tag tag is deleted.
I figured out how to detect when a tag to be deleted is clicked on. I was hoping to be able to add to Drupal.behaviors.communityTags, but that didn't work out.
So here is the JS that I wrote up. I hope this will help someone else:

document.onclick = deleteListener;

function deleteListener(e){
	var deletedElement;
	if(e==null){
		// I.E.
		deletedElement = event.srcElement;
	}else{
		// Firefox
		deletedElement = e.target;
	}
			
	if(deletedElement){
		if(deletedElement.tagName.toLowerCase()=="li" && deletedElement.className=="hover" && deletedElement.getAttribute("key")){
			var tag = deletedElement.innerHTML;
			$.post(url, { },
			function(data) {
				location.reload();					
			});
		}
	}
}