Errant button click sent to server when I press Enter in a form input

Hi All,

I use Comodo Dragon v96.0.4664.110 (64-bit) under Win10 Pro (64-bit). I should say all my Chromium browsers have this problem.

Load calendar.php (it will default to current month and year) and go to the Year field. Change the year and press Enter. When the calendar is reloaded you will see that the year is 1 less than you entered. Any year you enter will always come back 1 year less.

Load sample.php (it contains calendar.php in a iframe). Change the year and press Enter. When the calendar is reloaded you will see that it is correct. The year is not reduced by 1.

The reason calendar.php is off by 1 year is because when I press Enter CD sends an errant button click. In this case, the ‘prevYear’ button. The server sees this button click and subtracts 1 from the year. So, calendar.php has the problem but when loaded in a iframe there is no problem?

I can make calendar.php work correctly and make sample.php have the problem. All I have to do is change the order of 2 rows in the thead section. Right now id=nhead is the first row, so calendar.php has the Enter problem. If I place the id=nhead row below the id=shead row the Enter problem will change pages. sample.php now has the Enter problem while calendar.php works correctly. Now sample.php sends the errant button clcik. In this case it is the ‘prevmonth’, so the month gets reduced by 1.

The attachment has everything you need to see this problem.

In case the attachment doesn’t work it can be downloaded here

Thanks for any help,


Merry Christmas to all.

I found that if I place an empty alert(“”) command as the 1st line in the onSubmit() function then the errant button click is not sent. Of course, this doesn’t fix my problem but I wanted to mention it.

I was able to work around the problem by using an event listener. However, this method didn’t work until I added 1 line of code ‘event.preventDefault()’.

  let elem = document.getElementById("currentYear" + itm);
  elem.addEventListener("keydown", ({key}) =>
   if(key === "Enter")
    if(elem.value != "" && +elem.value >= 1)
    return false;
  document.getElementById("currentMonth" + itm).focus();

Thanks for looking,


Hi CharlesEF,

Thank you for reporting, could you please provide us the “steps to reproduce” ? so that we will check and report this to the team.



In the attachment there is a directory called ‘temp’. In this directory there is ‘calendar.php’. In fact, just unzip the attachment into your web server directory. In your browser load ‘temp/calendar.php’. Go to the ‘Year’ field and change the year, then press Enter. When the calendar is displayed you will see that the year is 1 less than the number you entered. This is because of the errant button click sent to the server. The left most button, ‘prevYear’, is the errant button click.

If you edit the’ thead’ section of ‘calendar.php’ and move the row with id=nhead below the row with id=shead you will see that the errant button click problem is moved to ‘sample.php’. On this page the left most button is ‘prevMonth’. Now the month gets reduced by 1. ‘calendar.php’ now works correctly.

Thanks for the help,


I don’t know if this errant button click is by design or a bug, I leave that to you. I just want to report that I bypassed the problem by placing a hidden submit button on the1st 2 rows in the thead section. This way I don’t test for the errant button at all. Didn’t need the fancy event listener I posted before.

Thanks for the help,