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:04

How to do that with version 5 ?


Poster: fpajot
Dated: Tuesday October 14 2003 - 12:38:05 BST

How can I do that with version 5 ?

The user arrives on a page HTML where the button "to validate" is in position "off". When it makes an action on the page, the button is put in position "on".

It's OK in version 3 with the "PlaceMenu" function. How can I do this with version 5 ?

My url :
http://marketing-direct.ort.fr/wektor_V3/index_VIS.ow
then click on the menu "Ancienneté" to see the example.

Thanks.

PS : Sorry for my bad english ...


Poster: Hergio
Dated: Wednesday October 15 2003 - 5:35:43 BST

I am unsure what you are asking. The validate pop up that comes up when you click that link has no menu in it....just a couple check boxes and a submit button.

If you want a menu position relatively, you can put the <SCRIPT> tags that include your menu_data file in the HTML where you want it to appear, thats as good as the PlaceMenu function.

How can I do that with version 5 ?


Poster: fpajot
Dated: Wednesday October 15 2003 - 7:53:05 BST

I already tested.

I have two menus: A menu of the type "off" and a menu of the type "on". With the function "PlaceMenu" of the version 3, these two menus are superimposed.
If I put the <SCRIPT> tags that include my menu_data file in the HTML, the two menus are not superimposed but one with the top of the other !

I also try to use the function popdown() but nothing occurs!

Thank you


Poster: Andy
Dated: Wednesday October 15 2003 - 11:20:35 BST

Hi,

The PlaceMenu() function has been removed from version 5. in place of actually embedding the menu inside the table cell.

Take a look at http://www.milonic.com/menusample.php?sampleid=9 for more info on how to put your menu inside a table.

Cheers
Andy


Poster: fpajot
Dated: Wednesday October 15 2003 - 12:09:20 BST

Hi,

I know that the PLaceMenu() function was removed.
I know how to put ONE menu in a table cell.
But if I want to put TWO menus in the same table cell, these two menus are not superimposed but one with the top of the other !

Take a look to my url
http://marketing-direct.ort.fr/wektor_V3/index_VIS.ow (Click on "Ancienneté") and see what I do with version 3 and which I
cannot make with version 5 !!!
The menu "valider_on" is posted when the customer notches a box.

Thanks


Poster: Andy
Dated: Wednesday October 15 2003 - 12:24:44 BST

We'll need to see the v5 menu - v3 isn't supported anymore.

Also, are you sure that both menus are declared with position="relative";

-- Andy


Poster: fpajot
Dated: Wednesday October 15 2003 - 12:27:22 BST

I'm sure !


Poster: Hergio
Dated: Wednesday October 15 2003 - 21:31:34 BST

Yeah it makes sense to me that relative would make the menus interact with each other. If you declare one menu (relative) and it renders itself, when the next one renders, its gotta fit itself in and take into consideration whats around it since its relative and the other menu happens to be around it, so they stack.

What you should do is have alittle bit of javascript in your code to determine which one to display. For instance, say you have a variable named toggle, you can set it to true or false and depending on what it is, a different menu will be rendered. I use a sample if else statement to show you how I pick which menu to render.
Code:
<SCRIPT language=JavaScript src="/milonic_src.js" type=text/javascript></SCRIPT>   
<script language=JavaScript>
if(ns4)_d.write("<scr"+"ipt language=JavaScript src=/mmenuns4.js><\/scr"+"ipt>");      
  else _d.write("<scr"+"ipt language=JavaScript src=/mmenudom.js><\/scr"+"ipt>");
</script>
...
...
...
<td>
<script language=JavaScript>
if( userStatus == "validated" ){ toggle = true; }else{ toggle = false; }

if(toggle)_d.write("<scr"+"ipt language=JavaScript src=/menu_data1.js><\/scr"+"ipt>");      
  else _d.write("<scr"+"ipt language=JavaScript src=/menu_data2.js><\/scr"+"ipt>");
</script></td>

A nice thing about this code is that it will be faster and quicker. You will no longer be downloading both menus and rendering them both everytime (like your page now does) . It will only download and render the required menu...this on top of the already increase speed of the v5 Milonic Menu!


Poster: fpajot
Dated: Thursday October 16 2003 - 10:57:17 BST

Sorry, you don't understand what I want to say ...

I need, when I charge the page, to have the two menus together.
The menu "OFF" is posted, the menu "ON" is hidden.
When the user makes an action on the page, the menu "ON" is posted on the menu "OFF" in order to mask it.

It's OK in version 5 by defining the identical top and left for the two menus.
But, if the two menus are defined with position relatively on a <td> tag, it doesn't work.

Thanks


Poster: Hergio
Dated: Thursday October 16 2003 - 16:28:55 BST

Well in your example, when I click the link you said and picked a value and submitted, the main page refreshed. What you could do is set a cookie to tell the main page to show with a different menu (use the code above but have the cookie determine what the toggle variable is set to). If the cookie is set, one menu shows, otherwise the other.

Or you could have your main page update with a queryString value. So it would update with http://www.usualURL.com?s=1 and in your page you would check for s equalling 1 in the querystring and if so, render a different menu like I showed above.

Because you want them relative you can't do what you want to do (as far as I know). The whole concept behind relative is just that, each menu interacts with and is positioned relative on whats around it, so two menus relatively positioned near eachother will try and render themselves as best they can. (Like HTML tables do, they dont overlap, they stack) I think rendering a different menu totally would be your best way to approach this. Good luck, and keep the questions comin if you'd like more ideas.


Poster: Maz
Dated: Thursday October 16 2003 - 19:37:17 BST

Dave, Just what I needed,
Thank you :D
maz

nb. I'm a little lost on the problem, its sounds like he may need one main menu with submenu options.


Poster: fpajot
Dated: Wednesday October 22 2003 - 8:44:10 BST

There is no possibility to have a PlaceMenu function in version 5 like in version 3 ?

My "valider" button (on and off) is a milonic menu.
For a static position of the "valider" button, I succeeded while making this :

Initialization Html code :
<SCRIPT language=JavaScript src="javascript/milonic_src.js" type=text/javascript></SCRIPT>
<script language=JavaScript>
if(ns4)_d.write("<scr"+"ipt language=JavaScript src=javascript/mmenuns4.js><\/scr"+"ipt>");
else _d.write("<scr"+"ipt language=JavaScript src=javascript/mmenudom.js><\/scr"+"ipt>");
</script>
<SCRIPT language=JavaScript src="javascript/menu_valider.js" type=text/javascript></SCRIPT>
<SCRIPT language=JavaScript>updateScreenPosition("valider",155,219)</script>
<SCRIPT language=JavaScript>updateScreenPosition("valider_off",155,219)</script>
<SCRIPT language=JavaScript>vmenu('valider','off')</script>


the two functions update ScreenPosition and vmenu :
function vmenu(menuname,curs) {
_mn=getMenuByName(menuname);
_gm=gmobj("menu"+_mn);
if(curs=="off")_m[_mn][8]=0;
if((curs=="on")||(curs==""))_m[_mn][8]=1;
if (_m[_mn][8]==1) popup(menuname)
}
function updateScreenPosition(menuname,_vpos,_hpos){_mn=getMenuByName(menuname);_gm=gmobj("menu"+_mn);_m[_mn][2]=null;_m[_mn][3]=null;_v2pos="top";_h2pos="left";if(_v2pos)_screenPos = _v2pos;if(_h2pos)_screenPos = _h2pos;if(_v2pos&&_h2pos)_screenPos = _v2pos+";"+_h2pos;_m[_mn][6]=_screenPos;if(_vpos>=0)_m[_mn][2]="offset="+_vpos;if(_hpos>=0)_m[_mn][3]="offset="+_hpos;_setPosition(_mn)}


The menu_valider.js :

with(ValiderStyle=new mm_style()){
onbgcolor ="#b71812";
offbgcolor="#b71812";
oncolor="#ffffff";
offcolor="#ffffff";
bordercolor="#000000";
borderstyle="solid";
borderwidth=1;
separatorcolor="#2D729D";
separatorsize="0";
padding=1;
fontsize="11";
fontstyle="normal";
fontfamily="arial";
pagecolor="black";
pagebgcolor="#b71812";
headercolor="#000000";
headerbgcolor="#ffffff";
subimage="images/arrow.gif";
subimagepadding="2";
}

with(ValiderOffStyle=new mm_style()){
oncolor="#808080";
onbgcolor="#f2f2f2";
offcolor="#808080";
offbgcolor="#f2f2f2";
bordercolor="#cccccc";
borderstyle="solid";
borderwidth=1;
separatorcolor="#2D729D";
separatorsize="0";
padding=1;
fontsize="11";
fontstyle="normal";
fontfamily="arial";
pagecolor="black";
pagebgcolor="#82B6D7";
headercolor="#000000";
headerbgcolor="#ffffff";
subimage="images/arrow.gif";
subimagepadding="2";
}


with(milonic=new menuname("valider")){
style=ValiderStyle;
alwaysvisible=1;
keepalive=1;
align="center";
itemwidth=60;
aI("text=Valider;url=javascript:valider()");
}

with(milonic=new menuname("valider_off")){
style=ValiderOffStyle;
alwaysvisible=1;
align="center";
itemwidth=60;
aI("text=Valider");
}


And the html for the onClick function :
<tr><td><input type=checkbox name="sel" onClick=\"javascript:vmenu('valider','on')\">TEXTE</td></tr>


This code is OK for a static position af the two menus (valider and valider_off). The menus are always in the same place, at the same position.

But when the page is dynamic, I cannot use this method because the
position of the button "to validate" (two superimposed menus milonic)
is not fixed. The number of TR tags is not defined !

In the version 3, I use the PlaceMenu() function to place the two menus in the same TD tag. With the version 5, I can't !

I am thus obliged to use the two versions in same code HTML! Not easy!


Poster: kevin3442
Dated: Friday October 24 2003 - 23:15:21 BST

fpajot,

Wow... that's alot to take in.

I think what you want to do can be done with v5. If I may... I think part of the problem is that your approach is too complicated. There are easier ways. For example, you are relying on the PlaceMenu() function in v3 because you are putting the two menus, superimposed, into a table cell. As far as I can tell, the only reason you are using a table cell is to position the menu. You could get rid of the table placement altogether by using the menu's very flexible built-in placement methods. By getting rid of the table, you don't need to worry about whether PlaceMenu() is available or whether you're using relative or absolute positioning.

You could have your two menus (one for the disabled button -- "valider-off" -- and one for the enabled -- "valider"), each with its own style, as you currently do it. Specify the position explicitly, using top= and left=... give both menus the same exact position. Set the valider_off to alwaysvisible=1, and valider to alwaysvisible=0 (to start).

I posted a couple of functions yesterday that might help:

Code:
function mm_showMenu(menuName) // , alwaysVisState = optional. 1=on, 0=off
{
  if (arguments.length > 1) _m[getMenuByName(menuName)][8] = arguments[1];
  popup(menuName);
}

function mm_hideMenu(menuName) // , alwaysVisState = optional. 1=on, 0=off
{
  var menuNum = getMenuByName(menuName);
  if (arguments.length > 1) {
    _m[menuNum][8] = arguments[1];
  }
  menuDisplay(menuNum, 0);
}

Call mm_showMenu("valider", 1); when a checkbox is enabled (much like you do now). The 1 in the second parameter also turns on the alwaysvisible property, so that the "valider" menu will not disappear when moused over but not clicked. To hide the menu call mm_hideMenu("valider", 0); the 0 turns alwaysvisible off as well (not really necessary, but it's neater that way). If you want, you could obviously wrap these two functions in your current vmenu() function, or simply take the guts out of these two functions and incorporate them into your vmenu() function... whatever works best for you.

Here are a couple more thoughts. Even though you could get the desired effect with v5 menus, as described above, and even though it's none of my business ;) , I have to wonder why you're using the menus at all to do this? Each menu has only one item. So, the valider_off menu is essentially a disabled button. The valider menu is essentially the same button, but enabled, and all it does when clicked is call a simple javascript function. So, I can't help wonder why you don't do this without the menus. There are other approaches that would probably be simpler and involve less overall code. For example, you could use a couple of simple images with some standard mouseover effects and an onclick event handler. Or, you could use an actual form button (setting it to enabled or disabled as needed). If you definitely want to use the menus to do this, why not just make the disabled button a simple image, and use only one menu (the enabled button) that you can show or hide as needed? Or, use only one menu item for both enabled and disabled, and modify its state programatically (which is easier to do in v5).

Anyway, this should give you some ideas to work with.

Hope that helps,

Kevin