cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - You can change your system assigned username to something more personal in your community settings. X

Callback after an attribute is modified

pchateil
1-Newbie

Callback after an attribute is modified

Hi all.

I need to use an attribute value to trigger an action.
In ACL, the modify_tag callback is called before a "Modify Attributes"
dialog box is opened.
What I need is to call a function after an attribute is modified.

Any thoughts?

Thanks.

Pierre Chateil
LCI TechPub Sud-ouest
France

3 REPLIES 3

You can do this with an attribute rule, or <att> in an Arbortext FOSI. See help 22.

Hi Pierre--

I'm not sure how you'd do that in ACL, but it's not very hard in AOM, if
you are comfortable with Java or JavaScript. You can attach an event
listener to the document object that listens for DOMAttrModified events,
and (after checking the element and attribute names) does whatever you
need done.

It would be something like this, in an editinit file (using the default
Rhino JavaScript flavor):

// *** untested code, debugging is left as a exercise ***
function attrEvent(event)
{
var node = event.target;
var attrname = event.relatedNode.nodeName;
if ((node.nodeName == "{target-node}") && (attrname ==
"{target-attr}")) {
Application.alert("Hey! You modified an " + attrname + " attribute
on a " + node.nodeName + " element!");
event.stopPropagation();
}
}

var doc = Application.activeDocument;
// define an object with the required handleEvent method
var o = { handleEvent: attrEvent };
var listener = Packages.org.w3c.dom.events.EventListener(o);
doc.addEventListener("DOMAttrModified", listener, true);


HTH.

--Clay

Clay Helberg
Senior Consultant
TerraXML



John Sillari
Chief Technologist
Technical Services Division
Dayton T. Brown, Inc.

Announcements

Top Tags