I have a template with a form, a JS executed onclick of submit button, an action execution after form submission and another template to which the user should be redirected ideally after successful form submission. If the validation fails it should give error message.
The problem I am facing is that it displays the required error message but even after displaying the error message, it redirects to the Thank You page. Can You guys help make it work as required? I do understand Symfony,HTML and JS but am no expert. I am learning by doing and hence would appreciate a little elaborated answer ~ ~
The form tag used:
<form name="myForm" method="post" enctype="multipart/form-data" action="/module/templateSubmit">
onclick event of submit:
var isError= false;
....validation conditions that set isError=True on failed validation.....
***where errorDiv is the div ID where error message is displayed on the form page
action for templateSubmit:
action for ThnakYouTemplate:
I guess that is all the info you need. If at all more information is required, just let me know.