Portal Engine Questions on portal engine and web parts.
Version 5.x > Portal Engine > CMS Menu Click calling custom javascript View modes: 
User avatar
Member
Member
fan4u - 8/24/2011 11:37:32 AM
   
CMS Menu Click calling custom javascript
HI,

How can i call a custom javascript function

function abc()
{
}

when we click on menu item, before menu action behaves as per standard behavior ?

User avatar
Member
Member
kentico_michal - 8/25/2011 1:44:06 AM
   
RE:CMS Menu Click calling custom javascript
Hello,

Regrettably, it is not supported to execute custom javascript with standard redirection behavior.

You would need to excute custom javascript code and then redirect users using javascript window.location. So, let's assume the following javascript function:

function myWindowOpen()
{
alert("hello");
window.location = "<url>";
return false;
}
</script>


You can place the function in CMSDesk -> Content -> select page with menu in tree -> Design -> Configuration of menu web part -> Content before field.

And than you call myWindowOpen() function in Javascript command property of a given document:

Javascript command: myWindowOpen();

Best regards,
Michal Legen