Jump to content

Confirm Form Submission


Renegade605

Recommended Posts

Hello, I've been trying to make a small JS script that would ask the user to confirm if he/she truly wished to submit a form.This is the source code:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=windows-1252" x-undefined><title>UF| Member CP</title><link rel="stylesheet" type="text/css" href="../external/stylesheet.css"><link rel="stylesheet" type="text/css" href="cpstyles.css"><script type="text/javascript"><!--function confirm_discharge(name);	{ return confirm("Are you sure you want to discharge " +name +"?"); }// --></script></head><body><div class="body"><div class="navigation">	<a id="nav_left"> </a><a href="../index.html">Home Page</a><a	href="http://forums.theunitedfrontclan.com/index.php">Forums</a><a	href="../recruitment/">Recruitment</a><a	href="../clan.html">Clan Structure</a><a	href="../rules.html">Server Rules</a><a	href="../memberCP/" id="nav_current">Member CP</a><a	id="nav_right"> </a></div><p class="center"><img style="float:left;margin-top:20px;" src="../images/banners/cod4_logo.gif" width="240" height="63" alt="Call of Duty 4" /><img style="float:right;" src="../images/banners/mohaas_logo.gif" width="240" height="105" alt="Medal of Honor: Spearhead" /><img src="../images/banners/banner.jpg" width="400" height="100" alt="UF| The United Front" /></p><h1>UF| Member Control Panel</h1><div class="invisible"></div><div class="invisible"></div><p class="center"><span class="faded">Connection to the UF| Member Database was successful.</span></p><hr /><div class="side"><p class="center"><span class="faded">You are logged in as <span style="font-weight: bold; color: #719537;">Renegade</span></span></p><table style="border-width: 0px; width: 100%;">	<tr><td class="title2"><a class="white" href="index.php">Control Panel Home</a></td></tr>	<tr><td class="notop"><a href="list_members.php?act=names">List Members</a></td></tr>				<tr><td class="notop"> </td></tr>	<tr><td class="title2">Official Records</td></tr>	<tr><td class="notop"><a href="records.php?act=service">Service Records</a></td></tr>		<tr><td class="notop"> </td></tr>	<tr><td class="title2">Manage Members</td></tr>	<tr><td class="notop"><a href="admin.php?act=pendingrecruits">Manage Pending Recruits</a></td></tr>	<tr><td class="notop"><a href="admin.php?act=discharge">Discharge Members</a></td></tr>				<tr><td class="notop"> </td></tr>	<tr><td class="title2">Options</td></tr>	<tr><td class="notop"><a href="login.php?error=logout">Log Out</a></td></tr></table></div><div class="main"><img src="../images/borders/top.png" alt="BORDER" />	<form method="post" onsubmit="return confirm_discharge('name');" action="admin.php">	<input type="hidden" name="act" value="discharge" />	<input type="hidden" name="CODE" value="1" />	<table class="center">		<tr>			<td>Member to Discharge:</td>			<td><select size="1" name="member">					<option selected="selected"> </option>					<option value="1">ATrain_James</option><option value="9">Lipton</option><option value="3">Renegade</option><option value="37">RenegadeTest2</option><option value="10">Spartan</option>			</select></td>		</tr>		<tr>			<td>Type of Discharge:</td>			<td><select size="1" name="type">					<option value="1">Honorable</option>					<option value="0">Dishonorable</option>			</select></td>		</tr>		<tr>			<td> </td>			<td><input type="submit" value="Proceed" /></td>		</tr>	</table></form>	</div><div class="footer"><img src="../images/borders/sides.png" /><div>© Copyright 2008 UF| The United Front<br />Powered by: XAMPP 1.6.7; Apache HTTP Server 2.2.9; PHP 5.2.6; MySQL 5.0.51b</div></div></div></body></html>

The original idea had been to put the value of the first select box in the JS prompt. When that didn't work I stripped it down to the neccesities. The confirm box should appear with the name 'name'. However, even with this simplest of versions of the script, nothing happens when I submit the form. I scoured the internet for hours trying to figure this out, but I'm stumped. What am I doing wrong here?

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...