I understand that it's common practice to call a validateRequiredFields() function which returns a boolean for the onsubmit value, as illustrated in the code below:
<form method="post" action="myPage.php" onsubmit="validateRequiredFields()">
Before implementing such a function, I've tried out the following code as a simple test to see whether it will keep me on the same page rather than redirecting me to myPage.php. However, I am being redirected nonetheless.
<form method="post" action="myPage.php" onsubmit="return false">