2

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">
rvelbon
  • 91
  • 5

1 Answers1

0

Please try this and see if it helps. Please add return false; at the bottom of the function or

onsubmit="return false;"

Try putting the ; at the end.

Koushik Das
  • 9,678
  • 3
  • 51
  • 50