Pressing the enter key submit page more than once

Pressing the enter key of the following page (created by JSP) submit page more than once.
Both alert popup boxes appear as expected:
alert('i ’ + i + ’ elem[i].checked ’ + elem[i].checked);
alert('alarmgroup ’ + alarmgroup + ’ rowsPerPage ’ + rowsPerPage);
appear.

However, then this alert appear again, which is unexpected:
alert('i ’ + i + ’ elem[i].checked ’ + elem[i].checked);

but alert('alarmgroup ’ + alarmgroup + ’ rowsPerPage ’ + rowsPerPage);
do not appear.

<?xml version="1.0" encoding="UTF-8" ?>
<!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=UTF-8" />
<link rel="stylesheet" type="text/css" media="all"
    href="/static/css/style.css" />
<link rel="stylesheet" type="text/css" media="all"
    href="/static/css/tablist.css" />
<link rel="stylesheet" type="text/css" media="all" href="/static/css/styleValidation.css" />
<script type="text/javascript" src="/static/js/prototype.js"></script>
<script type="text/javascript" src="js/util.js"></script>

<title>Hw Monitoring
</title>

<style type="text/css"> 
.pageNumber {
float:left;
padding: 3px 0;
margin-left: 0;
margin-bottom: 0;
margin-top: 0.1em;
font: bold 12px Verdana;
}
.pageNumber .noLink{
float:left;
padding: 3px 0.5em;
margin-right: 3px;
margin-top: 3px;
border: 1px solid white;
border-bottom: 1px solid white;
background: white;
}
.pageNumber a{
float:left;
text-decoration: none;
padding: 3px 0.5em;
margin-right: 3px;
margin-top: 3px;
border: 1px solid #778;
border-bottom: 1px solid gray;
background: white;
}
.pageNumber a:hover{
border-color: navy;
background-color: #8dd8f8;
color: #FFF;
.rowPerPage {
float:left;
padding: 3px 0;
margin-left: 0;
margin-bottom: 0;
margin-top: 0.1em;
font: bold 12px Verdana;
}
.rowPerPage {
float:left;
padding: 3px 0;
margin-left: 0;
margin-bottom: 0;
margin-top: 0.1em;
font: bold 12px Verdana;
}
</style> 
</head>

<script type="text/javascript">

  function init()
  {
  }
  
  function isEmpty(v) {
     return (v == null) || (v.length == 0);
  }

  function isInteger(v) {
     return !isEmpty(v) && !/[^\\d]/.test(v);
  }

  function setAlarmgroup() {
    var alarmgroup = 'all';
    var elem = document.getElementsByName("alarmradio");
    for (var i = 0; i < elem.length; i++) {
    alert('i ' + i + ' elem[i].checked ' + elem[i].checked);
       if (elem[i].checked) {
            alarmgroup = elem[i].value;
       }
    }
    
    var rowsPerPageElem = document.getElementById("rowsPerPage");
    var rowsPerPage = rowsPerPageElem.value;
       alert('alarmgroup ' + alarmgroup + ' rowsPerPage ' + rowsPerPage);
    if (!isInteger(rowsPerPage)) {
       alert('Rows per page should be an integer.  It is set to the default value of 20');
       rowsPerPage = 20;
    }
    var chkelem = document.getElementById("includingUnassignedTags");
    var includingUnassignedTags = chkelem.checked;
    
      window.location = "prod?rowsPerPage=" + rowsPerPage +
            "&includingUnassignedTags=" + includingUnassignedTags  + "&alarmgroup=" + alarmgroup;
   }  
  
   function setUnassignedTags()
   {
      setAlarmgroup();
   }
  
   function process(id, boxid, labelid) {
     var elem = document.getElementById(labelid);
     var checked = document.getElementById(boxid).checked;
     new Ajax.Request("prodManager", {
        method: "post",
        parameters: {
            id: id,
            boxchecked: checked
        },
        onComplete: function(){}
     });

     if (checked)
         elem.style.color = 'green';
     else
         elem.style.color = 'red';
   }  
  
  function refresh() {
     window.location.reload(true);
  }

  function timedRefresh(timeoutPeriod) {
    setTimeout("refresh();", timeoutPeriod);
  }
</script>

<body onload="init()">

<!-- header and menu -->
<div id="mainmenu">
<h1>Hw Event Manager</h1>
<div id="Logo"><img src="/static/img/Logo.jpg" width="63" height="63" alt=" Sytems"></div>
</div>

<form name="alarmform" action="prodMgr" method="post">
Choose alarm type
   <input type="radio" name="alarmradio" value="all" CHECKED onClick="setAlarmgroup()" /> All
    <input type="radio" name="alarmradio" value="ack" onClick="setAlarmgroup()" /> Ack
    <input type="radio" name="alarmradio" value="unack" onClick="setAlarmgroup()" /> Unacknowledged
   <input type="checkbox" name="includingUnassignedTags" id="includingUnassignedTags"  onClick="setUnassignedTags()">Unassigned Tags

<table class="resizable">
    <thead>
        <tr>
            <th>ID</th>
            <th>Date</th>
            <th>Time</th>
            <th>Hw Area</th>
            <th>Asset</th>
            <th>Alarm Description</th>
            <th>Alarm            <br></br>
                Acknowledgement</th>
        </tr>
    </thead>
    <tbody>
            <tr>
                    <td>4586</td>
                    <td>Fri May 28 2010</td>
                    <td>11:01:04 EDT</td>
                    <td>R1</td>
                    <td>N/A</td>
                    <td>R1 is not connected to server</td>
                <td>
                    <span id='span4586' class='fg-green'> 
                <input type="checkbox" name="checkboxChoice" id="box4586"
                    value="4586"
                    checked onClick="process(4586, 'box4586', 'span4586');">
                    Ack
                </span></td>
            </tr>
    </tbody>
</table>
</form>

<div id="rowPerPageDiv">
<form name="tagform" onsubmit="setUnassignedTags()">
  <input type="hidden" name="currPage" value="1"/>
  Rows Per Page<input type="text" name="rowsPerPage" id="rowsPerPage" value="50" />
  <input type="submit" value="Apply" onClick="setAlarmgroup()"><br>
</form>
</div>
</body>
</html>

The javascript method “setAlarmgroup” in your code is used to submit the form. Since you are calling this methos on “onClick” event of submit button and simaltaneously you are calling a method setUnassignedTags() on “onSubmit” event of the form. So the form is submitted twice. Do not use setUnassignedTags methos on “onSubmit” event of the form.

Cospro,
<snip>
[URL=“http://www.cosprotechnology.com”][URL=“http://forum.cosprotechnology.com”]