Encountered a form that is unchangeable in appearance:
<form id="mx_locator" name="mx_locator" method="post" action="search-results">
<!-- form elements -->
<span><input type="image" src="/images/search.png" onclick="loader()"></span>
</form>
This form is part of a CMS that automatically processes the form data and generates results when the submit button is clicked. The loader function is responsible for adding or removing a class to create an effect.
I have been assigned the task of creating a JavaScript code to validate this form. The form contains fields for zip code and city. Either one of these fields must be filled out - not both, but one or the other. Therefore, when the submit button is clicked, my JavaScript code should prevent the form from processing, check the fields, and proceed only if they meet the validation criteria.
My main concern is whether the form will still be processed regardless of the JavaScript actions, as the CMS controls its functionality. Unfortunately, I am unable to modify the HTML structure of the form, only add JavaScript code to it.