Portal Engine Questions on portal engine and web parts.
Version 6.x > Portal Engine > Menu actions - Javascript Command problem View modes: 
User avatar
Member
Member
treed - 10/22/2012 5:09:03 PM
   
Menu actions - Javascript Command problem
I'm using a simple repeater which is set to repeat for CMS.MenuItem's to create a menu. I would like to use the Properties - Menu - Menuactions - Javascript command: in my menu to trigger a JavaScript call to open a new page when the link is clicked. But when I add in my Javascript window.open("http://www.google.com"); and try out the link nothing happens. Even simple javascript like alert("test"); does nothing. Since I'm using a repeater to create my menu do I need to do something special in my transformation to actually get the javascript called that I enter into the Properties - Menu - Menuactions - Javascript command field?

Thanks
Todd

User avatar
Kentico Customer Success
Kentico Customer Success
kentico_martind2 - 10/23/2012 6:15:05 AM
   
RE:Menu actions - Javascript Command problem
Hi Todd,

Could you please show us your transformation?

Best regards,
Martin Danko

User avatar
Member
Member
treed - 10/23/2012 9:22:03 AM
   
RE:Menu actions - Javascript Command problem
Hi Martin,

Here is what I'm using for that repeaters transformation.
<li class="<%# ((int)Eval("isHighlighted") == 1?"active":"") %>">
<%# GetDocumentLink() %></a><div <%# ((int)Eval("isHighlighted") == 1?"":"style='display:none;'") %>>
<cc1:CMSRepeater ID="TertPages" runat="server" ClassNames="CMS.MenuItem" TransformationName="cms.menuitem.Dayton-TertNav" WhereCondition="documentmenuitemhideinnavigation = 0" OrderBy="NodeOrder" path="" MaxRelativeLevel="1" columns="*, case when '{%currentdocument.nodealiaspath%}' like NodeAliasPath + '%' then 1 else 0 end isHighlighted"></cc1:CMSRepeater></div></li>

User avatar
Kentico Customer Success
Kentico Customer Success
kentico_martind2 - 10/29/2012 4:15:40 AM
   
RE:Menu actions - Javascript Command problem
Hi Todd,

1. I would recommend you to use Eval<int>("isHighlighted") instead of ((int)Eval("isHighlighted")
2. I'm not sure if you can use char "*" in the expression
3. You need to handle the javascript in the transformation, in this case it won't work with JavaScript command field, it's for navigation WebPart only

Best regards,
Martin Danko