Jump to content

javascript:document.forms Submit Problem


Deanznet

Recommended Posts

hey! i have a script that submits on click the codes here.

 

javascript:document.forms['upload_form'].submit();

 

Works fine!

 

But when i add a login box to the top it wont work unless i remove

 

				<form name="login" form action="users.php?act=login-d" method="post">
<input type="hidden" name="return" value="" />

 

Any idea to this?

Link to comment
Share on other sites

Here Sorry About That..

 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/2002/REC-xhtml1-20020801/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="en-gb" xml:lang="en-gb">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta http-equiv="Content-Style-Type" content="text/css" />
<meta http-equiv="Content-Language" content="en-gb" />
<meta http-equiv="imagetoolbar" content="no" />
<title><# PAGE_TITLE #></title>
<meta name="keywords" content="image hosting, image hosting service, multiple image hosting, unlimited bandwidth, quick image hosting" />
<meta name="description" content="<# SITE_NAME #> is an easy image hosting solution for everyone." />
<base href="<# BASE_URL #>" />
<link href="style.css" rel="stylesheet" type="text/css" media="screen" />
<link rel="shortcut icon" href="css/images/favicon.ico" />
<script type="text/javascript" src="http<# URL_SCHEME #>.google-analytics.com/urchin.js"></script>
<script type="text/javascript" src="source/includes/genjscript.js"></script>
</head>
<body>
<div id="wrapper">
<div id="wrapper2">
	<div id="header">
		<div id="logo">
			<h1><# SITE_NAME #></h1>
		</div>


		<div id="loginbox">
			<form name="login" form action="users.php?act=login-d" method="post">
	  <td width='45%' align='right'><span class="style1">
	  
	  Username:</span></td><td><input type='text' name='username' size='25' value=''>  
      <td width='45%' align='right'><span class="style1">Password</span>:</td><td><input type='password' name='password' size='25'><center><br /><input name="Submit" type="submit"  value="Log In" /></td></div>


</div>
		<div id="menu">
			<ul>
				<li><a href="index.php">Homepage</a></li>
				<li><a href="gallery.php">Gallery</a></li>
				<li><a href="info.php?act=about_us">About</a></li>
				<li><a href="#">Resources</a></li>
				<li><a href="contact.php?act=contact_us">Contact</a></li>
			</ul>
		</div> 
</div>
	<!-- end #header -->
	<div id="page">
	  <div id="content">
		  <div class="post">
				<h2 class="title"><a href="#">Welcome to <# SITE_NAME #></a></h2>
Select an image file to upload - <a href="index.php?url=1">URL Upload</a><br />
Max file size is set at: <# MAX_FILESIZE #> per file.
<br /><br />
<form method="post" id="upload_form" enctype="multipart/form-data" action="upload.php">
<p>
	<input name="userfile[]" type="file" size="50" /> <br />
	<input name="userfile[]" type="file" size="50" /> <br />
	<input name="userfile[]" type="file" size="50" /> <br />
	<input name="userfile[]" type="file" size="50" /> <br />
	<input name="userfile[]" type="file" size="50" /> <br />
	<span id="more_file_inputs"></span> <br />
	<if="$mmhclass->info->is_user == false">
		Upload Type: <input type="radio" name="private_upload" value="0" checked="checked" /> Public <input type="radio" name="private_upload" value="1" /> Private <br /><br />
	</endif>
	<input class="button1"  type="button" onclick="javascript:new_file_input();" value="Add More Files" /> <input class="button1"  type="button" value="Start Uploading" onclick="javascript:toggle_lightbox('index.php?act=upload_in_progress', 'progress_bar_lightbox'); javascript:document.forms['upload_form'].submit();" />
</p>
</form>
			    

Link to comment
Share on other sites

Try adding this to the head of your document:

 

function button_action(){
   toggle_lightbox('index.php?act=upload_in_progress', 'progress_bar_lightbox')
   var target = document.getElementById("upload_form")
   target.submit()
}

 

And change your input tag to look like this:

 

<input class="button1"  type="submit" value="Start Uploading" onclick="button_action()" />

Link to comment
Share on other sites

Your problem is that you are trying to make two forms worth of function, but have only made one form. You need to separate the login functions from the upload functions, and put them in separate form tags. Do that first, post your code, then lets look at your javascript.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.