Is there a way to serialize only the visible form field values in prototype.js
? I have a form where two elements share the same name, but one is visible while the other is hidden. When I serialize the form using $('formid').serialize()
, both field values are included in the output like this:
<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="384d4b5d4a675d5559515405595a5b785d40595548545d165b">[email protected]</a>&mymodule_custom_delivery_area=20&mymodule_custom_delivery_area=test
The first element was a dropdown, while the second was a text box. The text box was hidden, and the dropdown was visible. They have the same name. I only want to include the value of the visible dropdown. How can I achieve this? Thank you