No, double checked that, there's no elements called submit within the form.
This is what the form looks like (minus the content), if that helps?
Code: Select all
<form name="pos_trans_add" method="post" action="pos_trans_add.php">
blah blah blah
</form>
When the javascript is run it definately does not go to action (pos_trans_add.php).
The button that triggers the javascript function looks like this though, maybe this can help?
Code: Select all
<!--BUTTON-->
<td rowspan="2" align="center" valign="middle">
<img name = "button_add" src="images/button_add.png"
onClick="check_transaction_type()"
onMouseOver="this.style.cursor='pointer'"
onMouseDown="document.button_add.src = 'images/button_add_down.png'"
onMouseOut="document.button_add.src = 'images/button_add.png'">
</td>
and just to be thorough, this is what the function looks like:
Code: Select all
<SCRIPT LANGUAGE = "JavaScript">
<!--
function check_transaction_type() {
var pos_employee = document.pos_trans_add.pos_employee;
var pos_product = document.pos_trans_add.pos_product;
var pos_service = document.pos_trans_add.pos_service;
var selected_employee = pos_employee.options[pos_employee.selectedIndex].value;
var selected_product = pos_product.options[pos_product.selectedIndex].value;
var selected_service = pos_service.options[pos_service.selectedIndex].value;
//Let's assume they passed the tests before we go ahead, we will change to false later if there's drama
pass = "true";
//if no EMPLOYEE has been chosen, let them know it
if (selected_employee == "")
{
alert('You have not chosen an Employee. Please do so before continuing with the transaction.');
pass = "false";
}
//if nothing has been chosen, let them know it
if (selected_service == "")
{
if (selected_product == "")
{
alert('No Service or product has been chosen. At least one service or product must be chosen.');
pass = "false";
}
}
//both Service AND Product have been chosen at the same time, let them know it
if (selected_service != "")
{
if (selected_product != "")
{
alert('You can only choose a service OR a product, not both at the same time. Please change your choice to only choose a product OR a service.');
pass = "false";
}
}
//if we passed the tests, then go ahead and submit the form, otherwise don't go anywhere (as we've shown the error already)
if (pass == "true")
{
document.form['pos_trans_add'].submit;
}
else
{
// do nothing... we've already given them their error messages
}
}
-->
</SCRIPT>