<form> onsubmit="some js function ...
the function should return TRUE if the data is valid and false if not.
This is the opposite of functions that find any errors and return error text strings.
Because any error text string will evaluate to TRUE!! although actually there is an error
and so the onclick should return FALSE.
If the update is done in ajax and you want to stay on this page, you can pretend the data is false
so that you stay on this page. In this case, you may need to refresh all the input values ready for another submission