Submit form

Having problems with DHTML Menu? There is usually somebody here who knows the answer.
Post Reply
php@madmonkey.co.za
Beginner
Beginner
Posts: 5
Joined: Fri Jul 16, 2004 12:13 am

Submit form

Post by php@madmonkey.co.za »

Why is the form.submit('this') not working from the menu_data.js?
User avatar
Maz
Milonic God
Milonic God
Posts: 1717
Joined: Fri Jun 06, 2003 11:39 pm
Location: San Francisco
Contact:

Post by Maz »

Can you show the whole line?

maz
php@madmonkey.co.za
Beginner
Beginner
Posts: 5
Joined: Fri Jul 16, 2004 12:13 am

Post by php@madmonkey.co.za »

This is not working

aI("text=Search;url=javascript:form.submit('this');");
User avatar
Maz
Milonic God
Milonic God
Posts: 1717
Joined: Fri Jun 06, 2003 11:39 pm
Location: San Francisco
Contact:

Post by Maz »

I'm not sure I understand what you are trying to do with this.

If you are trying to add a search box then that is incorrect.
But I can tell you how to do that, in
text=<form></form>;type=form;

There is a search form in the beginners section of the forum.

Either way you can let us know if you still have a problem.

maz
User avatar
kevin3442
Milonic God
Milonic God
Posts: 2460
Joined: Sat Sep 07, 2002 12:09 am
Location: Lincoln, NE
Contact:

Re: Submit form

Post by kevin3442 »

Hi,
php@madmonkey.co.za wrote:This is not working
aI("text=Search;url=javascript:form.submit('this');");
Just some syntax problems in the javascript; the submit() method doesn't take a parameter, and in this context 'this' is an object rather than a literal string as you have it. You probably mean

Code: Select all

this.form.submit()
Of course, that'll only work if the menu is defined inside of the form you want to submit. If that's the case, this.form should be implied and you'll probably find that a simple

Code: Select all

submit()
works just as well.

Hope that helps,

Kevin
php@madmonkey.co.za
Beginner
Beginner
Posts: 5
Joined: Fri Jul 16, 2004 12:13 am

Post by php@madmonkey.co.za »

In my search_data.js

Code: Select all

with(milonic=new menuname("Main Menu")){
style=XPMainStyle;
menuwidth="100%";
menualign="left";
alwaysvisible=1;
orientation="horizontal";
margin=4;
aI("text=Back;url=back.php;");
aI("text=Search;submit();"); 
aI("text=Cancel;url=list.php");
}
In my searchit.php

Code: Select all

<html>
<head>
<title>Search</title>
<style>BODY{background-color:#EFEDDE;}</style>
</head>
<body>
<form method="POST" action="searchit.php">
  <p>VMS #:
    <input type="text" name="stVMS" size="20" class=edit>
  <p>
  <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>
  <SCRIPT language=JavaScript src="search_data.js" type=text/javascript></SCRIPT>	
</form>
</body>
</html>
When you click on the menu button you will get a "Object excpected".

Thank You
User avatar
Ruth
 Team
 Team
Posts: 8763
Joined: Thu May 15, 2003 5:02 am
Location: Yucaipa, CA
Contact:

Post by Ruth »

I don't know doing forms, but I copied and pasted your code and what I get when I look at the menu on the page is

Code: Select all

Back  |  Search;submit() | Cancel
so what you put there is rendering as text. Is it supposed to be

Code: Select all

aI("text=Search;url=submit();");


Ruth
User avatar
Maz
Milonic God
Milonic God
Posts: 1717
Joined: Fri Jun 06, 2003 11:39 pm
Location: San Francisco
Contact:

Post by Maz »

I don't understand, if you want to go to the search page then the url is search.php maybe I don't understand the js not telling where to search.

I don't think you can put the menu inside a search form, that just looks wrong to me.

You can put the search inside text= and maybe even use javascript= then type=form

Once we figure out exactly what you are trying to do maybe someone can figure out the js.

maz
php@madmonkey.co.za
Beginner
Beginner
Posts: 5
Joined: Fri Jul 16, 2004 12:13 am

Post by php@madmonkey.co.za »

Menu item should look like

Code: Select all

aI("text=Search;url=javascript:submit();"); 
What I want to do is when you click on the search button it will submit the form
User avatar
John
 Team
 Team
Posts: 5967
Joined: Sun May 19, 2002 8:23 pm
Location: Phoenix, AZ
Contact:

Post by John »

I agree with Maz. I don't understand why the JS calls to the menu are inside the form.
John
php@madmonkey.co.za
Beginner
Beginner
Posts: 5
Joined: Fri Jul 16, 2004 12:13 am

Post by php@madmonkey.co.za »

The js calls is not in the form.

My menu_data.js file:

Code: Select all

_menuCloseDelay=500           // The time delay for menus to remain visible on mouse out
_menuOpenDelay=150            // The time delay before menus open on mouse over
_subOffsetTop=2               // Sub menu top offset
_subOffsetLeft=-10            // Sub menu left offset



with(XPMainStyle=new mm_style()){
onbgcolor="#C1D2EE";
oncolor="#000000";
offbgcolor="#EFEDDE";
offcolor="#000000";
bordercolor="#8A867A";
borderstyle="solid";
borderwidth=0;
separatorcolor="#EFEDDE";
separatorsize="15";
padding=3;
fontsize="75%";
fontstyle="normal";
fontweight="normal";
fontfamily="Tahoma,Helvetica,Verdana";
subimagepadding="2";
onborder="1px solid #316AC5";
offborder="1px solid #cccccc";
}


with(XPMenuStyle=new mm_style()){
onbgcolor="#C1D2EE";
oncolor="#000000";
offbgcolor="transparent";
offcolor="#000000";
bordercolor="#8A867A";
borderstyle="solid";
borderwidth=1;
separatorcolor="#8A867A";
separatorpadding="2";
separatoralign="right";
separatorwidth="100%";
padding=3;
fontsize="75%";
fontstyle="normal";
fontweight="normal";
fontfamily="Tahoma,Helvetica,Verdana";
image="xpblank.gif";
subimage="arrow.gif";
onborder="1px solid #316AC5";
overfilter="Fade(duration=0.3);Alpha(opacity=90);Shadow(color='#777777', Direction=135, Strength=5)";
outfilter="randomdissolve(duration=0.5)";
menubgimage="winxp.gif";
}


with(milonic=new menuname("Main Menu")){
style=XPMainStyle;
menuwidth="100%";
menualign="left";
alwaysvisible=1;
orientation="horizontal";
margin=4;
aI("text=Back;url=back.php;");
aI("text=Search;url=javascript:submit();"); 
aI("text=Cancel;url=list.php");
}

drawMenus();
 
My search.php file

Code: Select all

<html> 
<head> 
<title>Search</title> 
<style>BODY{background-color:#EFEDDE;}</style> 
</head> 
<body> 
<form method="POST" action="searchit.php"> 
  <p>VMS #: 
    <input type="text" name="stVMS" size="20"> 
  <p> 
  <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> 
  <SCRIPT language=JavaScript src="menu_data.js" type=text/javascript></SCRIPT>    
</form> 
</body> 
</html>  
I found another way to get the result I wanted
My mybutton.htm file.

Code: Select all

<html>

<head>
<style>
BODY{
  background: #EFEDDE; 

}
a.button{ 
   color: #000000; 
   background: #EFEDDE; 
   border: 2px outset; 
   text-align : center;
   font-family: Tahoma,Helvetica,Verdana; 
   font-style : normal ;
   font-size : 8pt;
   font-weight :normal;
   color :#000000;
   padding: 3px 4px; 
   text-align: center; 
   text-decoration: none; 
} 

a.button:hover{
  background-color: #C1D2EE;
  border-style: outset;
  border-color: #316AC5;
  border-width: 2px;
  color :#000000;
  
} 
</style>

<title>New Page 1</title>
</head>

<body>
<form method="POST" action="mybutton.htm">
  <a class="button" href="#" onClick="submit();">My button</a>
</form>
</body>

</html>
User avatar
John
 Team
 Team
Posts: 5967
Joined: Sun May 19, 2002 8:23 pm
Location: Phoenix, AZ
Contact:

Post by John »

php@madmonkey.co.za wrote:The js calls is not in the form.
Then this has me confused (which is sometimes easy to do)...
php@madmonkey.co.za wrote:My search.php file

Code: Select all

<html> 
<head> 
<title>Search</title> 
<style>BODY{background-color:#EFEDDE;}</style> 
</head> 
<body> 
<form method="POST" action="searchit.php"> 
  <p>VMS #: 
    <input type="text" name="stVMS" size="20"> 
  <p> 
  <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> 
  <SCRIPT language=JavaScript src="menu_data.js" type=text/javascript></SCRIPT>    
</form> 
</body> 
</html>  
John
Post Reply