
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-07-2016 10:17 AM
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
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)
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
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
Labels:
- Labels:
-
Archive
1 ACCEPTED ANSWER

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-08-2016 02:29 AM
Hi, everything looks OK. Can you try with below js code. Remove function() from top.
YAHOO.Bubbling.fire("registerAction",{ actionName: "onActionChangeTypo", fn: function custom_onActionChangeTypo(file) { var displayPromptText = this.msg("Do you want to expire this artefact?", file.displayName); alert(displayPromptText); } });
2 REPLIES 2

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-08-2016 02:29 AM
Hi, everything looks OK. Can you try with below js code. Remove function() from top.
YAHOO.Bubbling.fire("registerAction",{ actionName: "onActionChangeTypo", fn: function custom_onActionChangeTypo(file) { var displayPromptText = this.msg("Do you want to expire this artefact?", file.displayName); alert(displayPromptText); } });

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-08-2016 04:42 AM
Hi Niketa,
Thanks very much for the response.
I tried it and it worked.
Have a nice day!
Thanks,
Phani
Thanks very much for the response.
I tried it and it worked.
Have a nice day!
Thanks,
Phani
