I've got a page on my site with two freeform forms, each have different purposes. If I fill out either of the forms entirely (required fields) I am taken to the correct landing page and the correct notification is being sent out so all is functioning correctly there.
If do not enter all required fields the inline errors appear but for both forms rather than for the form I submitted.
Does anyone know of any way to make it so that the errors appear only on the submitted form?
I'm happy to create an extension using either the freeform_module_validate_begin
or freeform_module_validate_end
hooks but I'm just not sure where to start.
Any help would be greatly appreciated.
{exp:freeform:form form_name="product_demo_form" form:id="demo-form" required="name|email" return="{path='demo-enquiry-success'}" inline_errors="yes" inline_error_return="products/{url_title}/#demo-form"}
<input type="hidden" name="XID" value="{XID_HASH}" />
<input type="hidden" name="product_name" value="{title}" />
<div class="row">
<div class="col-md-4">
{if freeform:error:name}<span class="required">{form_error_name}</span>{/if}
{freeform:field:name attr:placeholder="Name *"}
</div>
<div class="col-md-4">
{if freeform:error:email}<span class="required">{form_error_email}</span>{/if}
{freeform:field:email attr:placeholder="Email *"}
</div>
<div class="col-md-4">
{freeform:field:phone attr:placeholder="Phone"}
</div>
</div>
{freeform:submit}
{/exp:freeform:form}
{exp:freeform:form form_name="product_pdf_download" form:id="download-form" required="name|email" return="{path='download-request-successful'}" inline_errors="yes" inline_error_return="products/{url_title}/#download-form"}
<input type="hidden" name="XID" value="{XID_HASH}" />
<input type="hidden" name="product_id" value="{entry_id}" />
<input type="hidden" name="product_name" value="{title}" />
<div class="row">
<div class="col-md-6">
{if freeform:error:name}<span class="required">{form_error_name}</span>{/if}
{freeform:field:name attr:placeholder="Name *"}
</div>
<div class="col-md-6">
{if freeform:error:email}<span class="required">{form_error_email}</span>{/if}
{freeform:field:email attr:placeholder="Email *"}
</div>
</div>
{freeform:submit}
{/exp:freeform:form}