AnsweredAssumed Answered

Custom client-side JavaScript not called

Question asked by pkanuri on Aug 7, 2016
Latest reply on Aug 8, 2016 by pkanuri
Apologies , code was missing in my original post.

Hi,

I have been trying , in vain, for 3 days now to call a custom client side jS function from an action.

In my share-config-custom.xml


<config evaluator="string-compare" condition="DocLibActions">
      <actions>
       <action id="document-archive" type="javascript" label="Archive">
            <param name="function">onActionChangeTypo</param>
         <permissions>
                <permission allow="true">Write</permission>
            </permissions>
            <param name="action">expire-artefact</param>
            <param name="successMessage">Artefact successfully expired</param>
            <param name="failureMessage">Failed to Expire artefact</param>
         </action>
      </actions>
                      ….
</config>

<!– Document Library Custom Code config section –>
   <config evaluator="string-compare" condition="DocLibCustom" replace="true">
       
         <dependencies>
            <!–css src="my-custom-action.css" /–>
            <js src="components/documentlibrary/my-custom-action.js" />
         </dependencies>
     
   </config>

I am able to view the "action" menuitem in the "Document Actions" . But clicking it does NOT call the function in my-custom-action.js that I had placed under ../tomcat/webapps/share/components/documentlibrary/my-custom-action.js (my-custom-action-min.js as well).

Here is the content of my-custom-action.js. It is quite straightforward. Just pop up a dialog (for now)

(function() {
    YAHOO.Bubbling.fire("registerAction",
    {
        actionName: "onActionChangeTypo",
        fn: function custom_onActionChangeTypo(file) {
           var displayPromptText = this.msg("Do you want to expire this artefact?", file.displayName);
        }
    });
})();



I am frustrated that my JS function isn't getting called at all. I've tried changing the paths in the dependencies but no luck.

Kindly let me know if I am missing something.

Really appreciate any help.

Thanks,
Phani

Outcomes