I have a form on my site that runs some basic JS validation when the user clicks submit, before the form is submitted, but I am getting an error 'unterminated string literal' when checking some of the fields.
I understand what this error is (users adding line breaks in a textarea in this case) but I cannot think of a way of avoiding/fixing it.
Here is how I declare the form -
<form id="<?php echo $form_name; ?>"
name="<?php echo $form_name; ?>"
class="standard-form"
method="POST" action=""
onsubmit="return validate_form('<?php echo $form_name; ?>')">
And here is how I am checking the field that is causing me trouble -
var your_query = document.forms['enquiry']['your_query'].value
if(your_query === ''){
result = false;
}
Any help here would be appriciated.
Thanks.