wrong form gets submitted

RESOLVED INVALID

Status

()

RESOLVED INVALID
11 years ago
4 years ago

People

(Reporter: alex, Unassigned)

Tracking

Trunk
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

(Reporter)

Description

11 years ago
User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9b4) Gecko/2008030714 Firefox/3.0b4
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9b4) Gecko/2008030714 Firefox/3.0b4

page contains 2 forms, clicking a submit button on the second form submits the first form (or at least executes javascript code for onSubmit of the first form.

Specifically - clicking cancel on the form below causes validateForm to be executed.

Here is the page source:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 <html xmlns="http://www.w3.org/1999/xhtml">
<meta http-equiv="Content-Type" content="text/html; Charset=iso-8859-1">
<title>Register PBX</title>
<!-- 6.0.1.16 -->
<link href="common.css" rel="stylesheet" type="text/css" />
<link href="blue.css" rel="stylesheet" type="text/css" />
<link href="custom.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" language="javascript">

function openPopup(url,name,opts)
{
    var popup = window.open(url,name,opts);
	
    if (!popup)
    {
	alert("Browser has blocked window popup. Please disable popup blocking for this site.");
    } else {
	popup.focus();
    };
}
</script>
<script type="text/javascript" src="prototype.js"></script>
<script type="text/javascript" src="scriptaculous.js"></script>
<script type="text/javascript" src="validate.js"></script>

</head>

<!-- BORDER TABLE -->
<!-- <body onLoad="breakout()"> -->
<body  >
<table align="left" class="wrapper">
<tbody><tr>
<td>

<!-- MAIN TABLE -->
<table width="100%" border="0" class="main">
  <tr>
    <td width="226" align="left" valign="top"><table width="100%" border="0">
      <tr>

<!-- ap: logo here -->         <td class="logo"><!-- LOGO --><a href="http://www.thirdlane.com"><img src="show.cgi?image=thirdlanelogo.gif" alt="" border="0"></a></td>
      </tr>
      <tr>
        <td>
	  
          <!-- NAV TABLE -->

<!-- NAV SUB-TABLE -->

<table class="navtable" align=left border="0">
<tbody>
<tr><td class="navtable-version">PBX Manager&nbsp;6.0.1</td></tr>

<tr><td class="navtable-top">&nbsp;</td></tr>
<tr><td class="navlink"><a href="index.cgi">Home</a></td>
</tr>
<tr><td class="navlink"><a href="index_cluster.cgi">Cluster Management</a></td>
</tr>
<tr><td class="navlink"><a href="servers.cgi">&#187; Registered PBXs</a></td>
</tr>
<tr><td class="navlink"><a href="tenants.cgi">Tenant Management</a></td>
</tr>
<tr><td class="navlink"><a href="index_settings.cgi">System Settings</a></td>
</tr>

<tr><td class="navlink"><a href="index_configuration.cgi">PBX Settings</a></td>
</tr>
<tr><td class="navlink"><a href="index_sound_files.cgi">Media Files</a></td>
</tr>
<tr><td class="navlink"><a href="index_resources.cgi">DIDs & Trunks</a></td>
</tr>
<tr><td class="navlink"><a href="index_usermanagement.cgi">Extensions & Directory</a></td>
</tr>
<tr><td class="navlink"><a href="index_routes.cgi">Routes</a></td>
</tr>

<tr><td class="navlink"><a href="index_features.cgi">PBX Features</a></td>
</tr>
<tr><td class="navlink"><a href="index_queues.cgi">ACD / Call Queues</a></td>
</tr>
<tr><td class="navlink"><a href="index_tools.cgi">Tools</a></td>
</tr>
<tr><td class="navlink"><a href="index_logging.cgi">Call History</a></td>
</tr>
<tr><td class="navlink-last navlink"><a href="http://192.168.1.210/thirdlane/root:10000" target='_blank'">blah</a></td>
</tr>
<tr><td class="navtable-bottom">&nbsp;</td>
</tr>

<!-- START OF RESTART -->
<tr><td>
<div class="warning-updates reload" onclick="restart_reload('reload');">Reload PBX</div><script type="text/javascript" language="javascript">
function restart_reload(which)
{
	if (which == 'restart') {
		if (!(confirm("Are you sure you want to restart your PBX?"))) {
			return;
		}
	}	
	var url = 'util.cgi';
	var poststr = 'm='  + which;
	var myAjax = new Ajax.Request(
		url, 
		{
			method: 'post', 
			parameters: poststr, 
			onComplete: showReloadResponse
		});
}		

function showReloadResponse(originalRequest)
{
	if (originalRequest.responseText != 'success') {
		alert(originalRequest.responseText);
	} else {
		if (window.location.href.match("save_net")) {
			window.location.href='edit_net.cgi';	
		} else {
			window.location.href=window.location.href	;
		}	
	}
}	
</script>
</td></tr><!-- END OF RESTART -->
</tbody>
</table>
<!-- END NAV SUB-TABLE -->

 		</td>
      </tr>
    </table></td>
    <td align="left" valign="top" class="content-td">

	<table width="100%" border="0">
  <tr>
<!-- ap: logged in here -->    <td align="right" valign="top" class="loggedin-td">
<div class="loggedin">Tenant:&nbsp;&nbsp;<select style='font-size: 1.1em' name=tenants_selector onChange="tenantSelected(this.options[this.selectedIndex].value)">
<option value="CESuites" >CESuites<option value="FreeAgent" >FreeAgent<option value="iTIP" >iTIP<option value="junk" >junk<option value="thirdlane" selected>thirdlane<option value="transactplus" >transactplus<option value="webinar" >webinar<option value="webinar2" >webinar2<option value="webinar3" >webinar3</select>&nbsp;&nbsp; Logged in: root &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <a class=lightlinks href="../session_login.cgi?logout=1">Logout</a></div></td>

  </tr>
 <tr class="tagline-tr">
<!-- ap: tagline here -->    <td><div class="tagline-bg"><div class="tagline">Register PBX&nbsp;&nbsp;</div></div></td>
</tr>
  <tr>
    <td align="left" valign="top" class="copysubtable">

<!-- COPY SUB-TABLE -->

<table class="copytable" align="left" width="100%">

<tr>
<td valign="top" >
<!-- COPY-->
<table width="100%" id="pagetable" class="pagetable" align=left>
<tr><td class="pagetable-td" xwidth="100%">
<script type="text/javascript" language="javascript">

function validateForm(theForm) {
	var error = "";
	var warning = "";
	if (theForm.host != undefined) { 
		if ( isEmpty(theForm.host.value) ) {
			error += "Host is missing or invalid\n";
		}
	}

	if ( checkNumeric(theForm.port.value) ) {
		error += "Port is missing or invalid\n";
	}

	if ( isEmpty(theForm.desc.value) ) {
		warning += "Description is missing\n";
	}

	if ( checkName(theForm.remoteuser.value) ) {
		error += "Login is missing or invalid\n";
	}

	if ( checkPassword(theForm.pass.value) ) {
		error += "Password is missing\n";
	}

	if (error != "") {
		alert(error);
		return false;
	}
	if (warning != "") {
		var r = confirm(warning + "Do you want to proceed?");
		return r;
	}
	return true;
}

</script>
<form name="mainForm" action=save_server.cgi method=post onSubmit="return validateForm(this);">
<input type=hidden name=id value=''>
<input type=hidden name=new value=''>
<table width=100% class=formtable>
<tr><td ><table width=100%>
<tr> <td valign=top nowrap><b>Server hostname<span class=warning>*</span></b></td>
<td width=100%>

<input name=host size=40 value=''>
</td> </tr>
<tr> <td valign=top nowrap><b>Port<span class=warning>*</span></b></td>
<td width=100%>
<input name=port id=port size=40 value=''>
</td> </tr>
<tr> <td valign=top nowrap><b>Short name</b></td>
<td width=100%>
<input name=desc id=desc size=20 value=''>
</td> </tr>

<tr> <td valign=top nowrap><b>PBX Manager login<span class=warning>*</span></b></td>
<td width=100%>
<input name=remoteuser id=remoteuser size=20 value=''>
</td> </tr>
<tr> <td valign=top nowrap><b>PBX Manager password<span class=warning>*</span></b></td>
<td width=100%>
<input name=pass id=pass type=password size=20 value=''>
</td> </tr>
<tr><td nowrap><b>SSL</b></td>

<td nowrap colspan=2>
<input type=radio name=ssl value=1 >&nbsp;&nbsp;yes
<input type=radio name=ssl value=0 checked>&nbsp;&nbsp;no
</td>
</tr>
<tr><td></td></tr>
</table></td></tr></table>
<table width=80%>
<tr><td align=left xwidth=100%>&nbsp;&nbsp;<input class=button type=submit value="Create">
</form>
<form action="servers.cgi">
<td><input class=button type=submit value="Cancel">
</form></td>
</tr></table>
</table>
<!-- END COPY SUB-TABLE -->
	
	</td>

  </tr>
</table>
	
	</td>
  </tr>
</table>

	</td>
  </tr>
</table>
<!-- END MAIN TABLE -->


<!-- FOOTER TABLE -->
<table width="100%" class="footer">
<tbody><tr><td align="left" nowrap="nowrap" class="footer-left"><span class="copyright">Licensed to: Third Lane.</span><a class="smallLinks" 
href='javascript:openWindow(&quot;license.txt&quot;, &quot;license&quot;, &quot;&quot;);'> License Terms
</a></td><td class="footer-right" align="right"><span class="copyright">&copy; Copyright 2003-2008 Third Lane Technologies, LLC. All rights reserved.</span></td></tr>
</tbody></table>

<!-- END FOOTER TABLE -->
</td></tr></tbody></table>
<!-- END BORDER TABLE -->
</body></html>


Reproducible: Always

Steps to Reproduce:
1.
2.
3.

Comment 1

11 years ago
Could you please attach your testcase in the bug? (using the "Add an attachment" link)
Pasting the html in the comment introduces line breaks which can change the meaning.
Component: General → HTML: Form Submission
OS: Windows XP → All
Product: Firefox → Core
Hardware: PC → All
Version: unspecified → Trunk

Updated

11 years ago
QA Contact: general → form-submission
Closed -> in the HTML code that is pasted, we can't reproduce it, because there are links to other js-Files. So we need a good example to verify.

please feel free to reopen this bug-report, if you have a new example or additonal informations to reproduce the problem.
Status: UNCONFIRMED → RESOLVED
Last Resolved: 4 years ago
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.