Milonic provide full featured pull down web menus for some of the worlds largest companies
click here to see what it can do for you

Download Milonic DHTML Menu
Buy Milonic DHTML Menu

Back To Start Of Archive
Taken From The Forum: Help & Support for DHTML Menu Version 5+
Forum Topic: Click to view post
Last Updated: Saturday July 14 2012 - 06:07:14

Need Help - mm_insertItem - Insert items into existing menu


Poster: gelid
Dated: Monday February 13 2006 - 19:30:51 GMT

I am having problems getting the mm_menueditapi.js to work. I have found a sample of how to add a new menu to the page and have succesfully gotten that to work. I need to add additional items into an existing menu.

Here is a sample of what I am doing:
I already have a menu called MainMenu and I use the following to insert an additional item -
mm_insertItem('MainMenu',3,'text=New Order;Status=New Order;url=Shopping/Default.aspx;')

I have put the above statement before and after drawMenus() call without any luck. Does anyone have a sample of this in action?

Any help would be greatly appreciated.


Poster: Migru
Dated: Tuesday February 14 2006 - 7:08:40 GMT

Hi


there seems to be a sample here:

http://www.milonic.com/insertitem.htm
though I´m not using it. So sorry no experience in this.

Michael


Poster: gelid
Dated: Tuesday February 14 2006 - 13:41:51 GMT

I thought the insertitem was replaced with mm_menueditapi.js. I just tried the insertitem and it did not do anything. It did not give me any errors, but it also failed to insert the item into the menu. Any other ideas?


Poster: Migru
Dated: Tuesday February 14 2006 - 20:11:59 GMT

Hi

I´m sorry there is something wrong with this link/result

http://www.milonic.com/insertitem.htm

the zip file there contains the source

http://www.milonic.com/insertitem.htm which targets to

http://www.milonic.com/insertitem.htm

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! MILONIC HELP !!!!!!!!!!!!!!!!!!!!!!!!!!!! PLEASE


Michael


Poster: Ruth
Dated: Friday February 17 2006 - 6:10:12 GMT

Hi Michael,

The insertitem module was a demonstration put together for someone a long time ago, as it developed it became the menueditapi.js module which has that included in it. I believe that is still up just in case there is anyone still using an old version 5 level and it won't work with the newer releases.

Ruth


Poster: Migru
Dated: Friday February 17 2006 - 6:55:18 GMT

Hi Ruth

When posts ask for help, first thing I do is I´m looking for sample pages. That is why I came across that link.
I wasn´t aware too, that syntax is included in this menueditapi.js file.
Thanks

Michael


Poster: Ruth
Dated: Friday February 17 2006 - 7:09:50 GMT

Hi Michael,

How's it going? That menueditapi.js module is supposed to let you, insert an item, delete an item, edit an item. I've never been able to get it to work right, and I know others have, so I have to be doing some dumb thing. Anyway, I have links to when this was originally done if you want to take a look

http://www.milonic.com/forum/viewtopic.php?p=22896

http://www.milonic.com/forum/viewtopic.php?t=5451

Ruth


Poster: Andy
Dated: Friday February 24 2006 - 16:42:17 GMT

Heres a demo I've just published to show how to add, edit and delete stuff:

http://www.milonic.com/menueditapi.php

Hope this helps,.
Andy


Poster: Ruth
Dated: Saturday February 25 2006 - 4:15:22 GMT

Terrific, Andy!

This is great.

Ruth

Doing something wrong


Poster: gelid
Dated: Friday March 3 2006 - 20:25:38 GMT

I obviously still doing something wrong. Here is my code.

Main Static Menu w/ style:

with(MainMenuStyle=new mm_style()){
styleid="1";
styledescription="MainMenuStyle";
bordercolor="#8A867A";
borderstyle="solid";
borderwidth="1";
fontfamily="Tahoma,Helvetica,Verdana";
fontsize="9pt";
fontstyle="normal";
fontweight="normal";
imagepadding="0";
menubgcolor="#9d5022";
offbgcolor="#b7bb98";
offcolor="#000000";
onbgcolor="#f3f8cb";
onborder="1px solid #515340";
oncolor="#000000";
overfilter="Fade(duration=0.2);Alpha(opacity=90);Shadow(color=#b4b989', Direction=135, Strength=1)";
padding="3";
separatoralign="right";
separatorcolor="#afb484";
separatorpadding="1";
subimage="" + HOME_DIRECTORY + "Library/Menu/arrow.gif";
subimagepadding="3";
menualign="center";
}


with(ExtranetMainMenu=new menuname("ExtranetMainMenu")){
styleid="1";
optiondescription="Main Menu Option";
alwaysvisible="1";
top="93";
orientation="horizontal";
menualign="center";
menuwidth="800";
alignment="left";
screenposition="center";
style=MainMenuStyle;
aI("status=Welcome;text=Home;url=" + HOME_DIRECTORY + "default/;")
aI("status=Profile;showmenu=Menu_3;text=Profile;")
aI("status=My Orders;showmenu=Menu_7;text=My Orders;")
aI("status=Customers;showmenu=Menu_26;text=Customers;")
aI("status=Tasks;showmenu=Menu_24;text=Tasks;")
aI("status=Logout;text=Logout;url=" + HOME_DIRECTORY + "Authenticate/Logout.aspx;")
}

Insert Item Code:
mm_insertItem('ExtranetMainMenu',31,'text=Shopping;Status=Shopping;url=Shopping/Authenticate/Login.aspx;')

The code runs but it actually makes allt he stic items disappear. It looks like the items are actually hiding under the background color of the menu, at least that is what it appears to do.

Any thoughts on how to get to work? This should be simple. I have a static menu to which I need to add dynamic items. These items do not even have to be added using any sort of button but rather will just be put on the page on load. Any help would greatly be appreciated.


Poster: Migru
Dated: Friday March 3 2006 - 22:42:20 GMT

Hi

could not get your "main static Menu w/style" in operation.
I´m sorry had no time to check your syntax, but it did not work.
Can´t you provide a url?


Michael


Poster: gelid
Dated: Monday March 6 2006 - 20:06:45 GMT

here is a link http://www.infinitumpro.net/site/default.htm to a sample of what I am trying to do. The file is not pretty because I had to remove all of the info my companies internal info, but the page is functional as is. You will notice I have some javascript commented out in the html, uncomment the code to see what i am talkign about.

Thanks for all your help.

Shawn


Poster: les35
Dated: Thursday March 9 2006 - 19:54:40 GMT

I too am having a lot of trouble getting mm_insertItem() to work.

I have uploaded a test page showing what I have (and I'll also include the code below in this post)

This page shows the code with the mm_insertItem()
http://www.esaba.com/menutest/with_insert.html

This page shows the same code with mm_insertItem() commented out
http://www.esaba.com/menutest/without_insert.html

You can find all the files used here:
http://www.esaba.com/menutest/

What am I doing wrong?


In menu_data.js i have:
Code:

fixMozillaZIndex=true; //Fixes Z-Index problem  with Mozilla browsers but causes odd scrolling problem, toggle to see if it helps
_menuCloseDelay=500;
_menuOpenDelay=250;
_subOffsetTop=2;
_subOffsetLeft=-2;

forgetClickValue="true";

with(menuStyle=new mm_style()){
bordercolor="#000088";
borderstyle="solid";
borderwidth=1;
fontfamily="arial, tahoma";
fontsize=14;
fontstyle="normal";
headerbgcolor="#AFD1B5";
headercolor="#000099";
offbgcolor="transparent";
offcolor="#000000";
onbgcolor="#FEFAD2";
oncolor="#000000";
outfilter="Fade(duration=0.1);Alpha(opacity=95);Shadow(color=#777777', Direction=135, Strength=3)";
overfilter="Fade(duration=0.1);Alpha(opacity=95);Shadow(color=#777777', Direction=135, Strength=3)";
padding=3;
pagebgcolor="#e5ecf9";
pagecolor="#000066";
separatorcolor="#000088";
styleid=1;
headerborder=1;
imagepadding=3;
onborder="1px solid #000088";
separatoralign="right";
separatorpadding=1;
separatorwidth="85%";
valign="middle";
menubgcolor="#e5ecf9";
keepalive=1;
openonclick=1;
}

with(top=new menuname("Main")){
screenposition="center";
alwaysvisible=1;
orientation="horizontal";
style=menuStyle;
top=100;
aI("showmenu=Open;text=Open;");
}

with(bottom=new menuname("Open")){
screenposition="center";
orientation="horizontal";
style=menuStyle;
margin=2;
aI("text=Hello;url=something.html;");
}

drawMenus();



In my html I have:
Code:
<html>

<head>
<script type="text/javascript">
function startCheck()
{
   mm_insertItem('Main',1,'text=NewItem;url=test.html;');
}
</script>
</head>

<body onLoad="startCheck();">
<a href="http://www.milonic.com/">JavaScript DHTML Drop Down Menu By Milonic</a>
<script type="text/javascript" src="milonic_src.js"></script>
<script type="text/javascript" src="mm_menueditapi.js"></script>
<script type="text/javascript">
if(ns4)_d.write("<scr"+"ipt type=text/javascript src=mmenuns4.js><\/scr"+"ipt>");
  else _d.write("<scr"+"ipt type=text/javascript src=mmenudom.js><\/scr"+"ipt>");
</script>
<script type="text/javascript" src="menu_data.js"></script>
</body>

</html>



If I comment out the mm_insertItem() call, the menu displays fine.
If I leave the mm_insertItem call in, the menu doesn't show.

mm_menueditapi.js function _incItem(_aI) renamed to f_(_aI)


Poster: Hubert_Wagner
Dated: Friday March 17 2006 - 5:16:28 GMT

I had the same problem until I edited the function mm_insertItem in mm_menueditapi.js
I commented out this line:

Code:
// _incItem(_aI);


and replaced it with this line:
Code:
f_(_aI);

Re: mm_menueditapi.js function _incItem(_aI) renamed to f_(_


Poster: les35
Dated: Friday March 17 2006 - 14:07:14 GMT

Hubert_Wagner wrote:
I had the same problem until I edited the function mm_insertItem in mm_menueditapi.js
I commented out this line:

Code:
// _incItem(_aI);


and replaced it with this line:
Code:
f_(_aI);

That's weird. I just checked my mm_menueditapi.js file, and the "_incItem(_aI)" line was already changed to "f_(_aI)"

There seems to be different versions of mm_menueditapi.js hosted on milonic.com

Could you please upload your mm_menueditapi.js and post a link so I can try it.


Poster: gelid
Dated: Monday March 20 2006 - 17:16:46 GMT

I get an error using either one of those lines. I would also like to see the version that is working.

Is anyone trying to do this on page load? I am trying to add menu items on page load; meaning I am not using any type of button click or anything to create the menu as is done in the sample.

Any help would be greatly appreciated.


Poster: les35
Dated: Monday March 20 2006 - 18:00:18 GMT

gelid wrote:
I get an error using either one of those lines. I would also like to see the version that is working.

Is anyone trying to do this on page load? I am trying to add menu items on page load; meaning I am not using any type of button click or anything to create the menu as is done in the sample.

Any help would be greatly appreciated.

I am also looking to use this on page load. Specifically, I want to use information stored in a cookie to determine which menu items load and which don't.

I'm surprised this issue is taking so long to resolve. Normally, I would have given up on Milonic long ago and went with one of the many other menu options available. However I have other projects with priority over the one using the milonic menu, so I can put the milonic menu project on the back burner until this issue is resolved.


Poster: Migru
Dated: Monday March 20 2006 - 18:12:54 GMT

Hi
I´m wondering, really,
theres a sample (see above) to demonstrate how it works.
And there still seems to exist some contradiction or confusion about the way to implement it.
What is the issue and what is to resolve?
So, if you have a real problem (and a license) why don´t you send a formal request to Milonic?
I´m not using this function (at present), so can´t help, no experience on this at all. Sorry.

Michael


Poster: gelid
Dated: Monday March 20 2006 - 18:38:36 GMT

I have submitted it to Milonic support as well. I am posting in the forums because support has not been able to resolve it yet.

Here is what I am trying to do.

I have a standard menu filled with static menu items. I also have several dynamic items what will be added tot he menu based on the type of user logged in. To do this, I want to add the items on page load. I want to do this just by writing out a session variable I hold for each user. All of my development is in ASP.NET, but I do not think this has anything to do with the issues I am having.


Poster: Ruth
Dated: Monday March 20 2006 - 19:16:25 GMT

Hi,

I wanted to post this link, just in case it had anything to help. I know it's not to do with the mm_menueditapi.js module, but you mentioned the asp.net thingee and this has to do with that. The link goes to the post with the demo links in it. It probably doesn't have anything to do with what you want.

http://www.milonic.com/forum/viewtopic. ... 7360#27360

Noting that this is beyond my knowledge level, if I understand correctly:
1. you want all 'general' users to have a particular 'static' menu,
2. other users are to have additional 'menus or items, and finally,
3. the other users are divided into different groups so there is a distinction between these users and they need different menus or items based on a particular log-in.

Is this correct? And, in addition, do these menus that are loaded based on login have to be dynamic because they 'change' by day, or dept or something?

Ruth


Poster: gelid
Dated: Monday March 20 2006 - 19:34:01 GMT

I took a look at the .NET control demo. It was nice but did not provide the funcitonality that I was look for. I ended up building a few controls of my own and a class library to handle all Milonic menu functions.

1. Yes, the static menu is available to all users. I reference this menu through an js include file, just like all of the samples.
2. Some users will have additional menu items that are custom for each user.
3. The custom items are tailored to the credentials of each user.

- The entire menu is in a database. It can be changed on the fly and the items therefore can be changed in real time.


Poster: Ruth
Dated: Monday March 20 2006 - 22:26:57 GMT

Hi,

I'm sorry to bug you, but I'm trying to understand what you are trying to do.

It seems as if, more or less, you want different menus dependant upon particular conditions.

I found a post I remembered from a long time ago, this isn't the menueditapi, but a person wanted the menu setup based on whether the user was logged in or not, I don't know if this will help or not either.

http://www.milonic.com/forum/viewtopic.php?p=13544


I can't figure out how the menueditapi.js module is going to do what you want. You're saying that in effect, if I understand, you want a number of different menus, so you'd have to have different things in the in the menu_data.js file that use the menueditapi.js module to be, inserted, deleted etc. So, I woud think you had to have some way of telling the menu which things to use of those you have listed for the menueditapi.js module based on which conditions. If I'm correct, and I am probably way off base here, I think you'd have to have some kind fo function that sets up and uses whatever the conditions are, kind of like:

Code:
if userIsGen, then do not insert any item, else if userIsLev1, then
mm_insertItem('Main Menu',2,'text=New Item; else if userIsLev2 mm_insertItem('Main Menu',2,'text=New Item2;') ; 


and so on

How many 'different' menus do you need? Maybe you could set up a function that loads a menu_data.js file based on the particular user, and then each file would have it's own mm_insert/delete/change stuff in it or not in it if that wasn't needed?

I'm just throwing out ideas here, maybe they will give someone an idea, then again maybe they are all wet! :lol:

Ruth

demo http://www.milonic.com/menueditapi.php does not work


Poster: Hubert_Wagner
Dated: Wednesday March 22 2006 - 2:49:45 GMT

The demo at http://www.milonic.com/menueditapi.php throws an "Object expected" error on line 255 which seems to be "_getDims();" in function mm_createNewMenus() when clicking "Create New Menu".

I'm using IE 6.


Poster: Ruth
Dated: Wednesday March 22 2006 - 4:18:30 GMT

Hi,

Thank you. I've reported it. Milonic is usually very good and getting things fixed quickly. I'll post back when I know something.


Ruth


Poster: Ruth
Dated: Wednesday March 22 2006 - 22:58:13 GMT

Hi

It looks to be fixed. I think :? Not something I use :)

Ruth


Poster: gelid
Dated: Wednesday March 22 2006 - 23:40:06 GMT

Where can i get the file that is working? I am still having issues with the file i have.

Thanks,


Poster: Ruth
Dated: Thursday March 23 2006 - 7:46:40 GMT

Hi,

I don't know which file you mean. If you mean the menueditapi.js module, then it's at http://www.milonic.com/menumodules.php You need to go down about 4 or 5 items or so.

If you mean that little demo it's here

http://www.milonic.com/menueditapi.php

Ruth


Poster: les35
Dated: Sunday March 26 2006 - 19:34:01 BST

Ruth wrote:
Hi,

I don't know which file you mean. If you mean the menueditapi.js module, then it's at http://www.milonic.com/menumodules.php You need to go down about 4 or 5 items or so.

If you mean that little demo it's here

http://www.milonic.com/menueditapi.php

Ruth

Can you look at the code I posted earlier in this thread and tell me why it does not work?


Poster: Ruth
Dated: Sunday March 26 2006 - 22:45:35 BST

I'm sorry, I can't. I'm trying to get some direction from Milonic since I can't get the module to work at all. But, I've always had trouble with it and that is not the module, it is the lack of knowledge on my part.

As soon as I get some information I'll let you know.

Ruth


Poster: les35
Dated: Monday March 27 2006 - 19:51:19 BST

Ruth wrote:
I'm sorry, I can't. I'm trying to get some direction from Milonic since I can't get the module to work at all. But, I've always had trouble with it and that is not the module, it is the lack of knowledge on my part.

As soon as I get some information I'll let you know.

Ruth

Thanks Ruth. I'll be eagerly checking this thread. :)


Poster: Andy
Dated: Monday April 10 2006 - 15:08:37 BST

Hi,

I have added a new directory to the menu downloads called dynamic_menus.

This is in /extras/dynamic_menus

It is a demo of how to use the Menu Edit Module.

Hope this helps,
Andy


Poster: les35
Dated: Wednesday April 12 2006 - 15:50:55 BST

Andy wrote:
Hi,

I have added a new directory to the menu downloads called dynamic_menus.

This is in /extras/dynamic_menus

It is a demo of how to use the Menu Edit Module.

Hope this helps,
Andy

Where is it? I can't find it.


Poster: Migru
Dated: Wednesday April 12 2006 - 17:01:26 BST

Hi

you have to log in, then load

http://www.milonic.com/menuvinfo.php

and download the version 5_746 which is for instance zipped. This contains a folder extras and the subfolder dynamic_menus
Quote:
Andy wrote:
Hi,
I have added a new directory to the menu downloads called dynamic_menus.


Michael


Poster: jttaynton
Dated: Monday July 17 2006 - 23:23:25 BST

To go along with the rest of this thread ... we are using mm_insertItem quite extensively. We were having some issues with menus appearing and disappearing with the use of that function but those issues appear to be cleared up using the latest menu build.

Now whenever mm_insertItem is used the menus are displaying on-screen and working fine but each page using that function is throwing a script error:

Error: Object expected

This error appears to trace back to the mm_menueditapi.js function _rbMenus(m) at the line:

if(_gm.style.visibility==$6){

any ideas on what may be causing this? it is happening on any and call pages using the mm_insertItem and the menu files are all the latest available.

thanks


Poster: Andy
Dated: Monday July 24 2006 - 12:56:30 BST

Have you got a URL that we can see?


Poster: khendrix
Dated: Friday August 18 2006 - 17:35:16 BST

some observations on use of the dynamic menu module ... not sure if this will help anyone, but it gave me some problems.

you can pre-create menus and then change them dynamically. at page load time, you could have code like
Code:
with (menuCOSymbols = new menuname("Checkout Symbols")) {
  style=menuStyle;
  alwaysvisible=0;
  aI("text=TEMP;offclass=menuNews");
}

drawMenus();

and then later add menu elements with code like
Code:
mm_insertItem(getMenuByName("Checkout Symbols"), 1, "text=ASDF;url=javascript:menuDeleteCheckoutSymbol('ASDF');offclass=menuNews");

my problems in understanding this were 2-fold ... first, the mm_insertItem() function accepts as it's 1st parameter a menuRef number , not a string like the sample syntax in mm_menueditapi.js. second, if attempting to pre-create a menu as above, the menu MUST have at least one menu item in order to be created by drawMenus() ... hence the "TEMP" aI() function call above.

knowing this has made it simple to maintain 4+ separate dynamic menus on a page simultaneously.