PDA

View Full Version : JS question: comment submit hook?


rutt
Mar-08-2006, 11:12 AM
Suppose I want to write a function which gets called each time SubmitComment succeeds. One way to do this, probably not so great is to rewrite SubmitCommnet and add the code myself. I'm not exactly if I can make this work, if I can get the redefine to happen in the right place, but even if I could it wouldn't be the best because SubmitComment might change and my version wouldn't.

Is there a better way to do this? If not, is it reasonable to ask for some sort of actual hook?

rainforest1155
Mar-11-2006, 12:08 PM
Bump for Rutt's very interesting journey on to new terrains in case of JS in smugmug. If this works out we'll have a least a temporary workaround until smugmug launches some kind of comment control panel like I envisioned here (http://www.dgrin.com/showthread.php?t=21629). :D
If we had this already, he would have already known that I left him an answear to his comment over here (http://rainforest1155.smugmug.com/gallery/1241790/1/59221753/Large). :wink

Sebastian

devbobo
Mar-11-2006, 03:53 PM
Rutt,

Here's something that should get you started....


if (oComment = document.getElementById("addAlbumComment"))
{
oInputs = oComment.getElementsByTagName("input");
addEvent(oInputs[1], "click", commentHandler);
}

function commentHandler()
{
alert('called');
}

Cheers,

David

rutt
Mar-12-2006, 07:58 AM
Thanks!

Rutt,

Here's something that should get you started....


if (oComment = document.getElementById("addAlbumComment"))
{
oInputs = oComment.getElementsByTagName("input");
addEvent(oInputs[1], "click", commentHandler);
}

function commentHandler()
{
alert('called');
}

Cheers,

David