I have a single contact form template that changes its form_name based on a segment variable.
{if seg_2=="barcode"}
{exp:freeform:form form_name="barcode_quote_request" return="contact/thank-you" notify="info@domain.com" required="firstname|lastname|company|type|email|phone|address|city|state|postalcode|country|product|message"}
{if:elseif seg_2=="cad"}
{exp:freeform:form form_name="cad_quote_request" return="contact/thank-you" notify="info@domain.com" required="firstname|lastname|company|type|email|phone|address|city|state|postalcode|country|product|message"}
{if:else}
{exp:freeform:form form_name="contact_request" return="contact/thank-you" notify="info@domain.com" required="firstname|lastname|company|type|email|phone|address|city|state|postalcode|country|product|message"}
{/if}
{embed="includes/inc-contact"}
{/exp:freeform:form}
So as you can see there are 3 types a barcode from, a cad form and a generic form. With links of www.domain.com/contact/barcode, www.domain.com/contact/cad and www.domain.com/contact respectively. The barcode and cad forms work fine. Its the form that doesn’t have a segment variable that has the problem. The form shows up as it should, but when you hit submit, nothing happens. No email gets sent out. No empty field checking. No sending off to the thank you page. Here is the code generated for the contact form (minus the actual form fields).
<form id='freeform' name='contact_request' method="post" action="http://www.domain.com/contact/form/" >
<div>
<input type="hidden" name="ACT" value="20" />
<input type="hidden" name="URI" value="/contact/form/" />
<input type="hidden" name="XID" value="48316b6c7811c77b9a26e4e7e53a2b33a32e792a" />
<input type="hidden" name="return" value="contact/thank-you" />
<input type="hidden" name="redirect_on_duplicate" value="" />
<input type="hidden" name="RET" value="http://www.domain.com/contact/form/" />
<input type="hidden" name="form_name" value="contact_request" />
<input type="hidden" name="id" value="freeform" />
<input type="hidden" name="tagdata" value="" />
<input type="hidden" name="params_id" value="424" />
</div>
<input type="submit" value="Submit" class="submit" />
</form>
Any idea why this isn’t submitting??? The other ones work perfectly. The only difference is that segment URL.
I’d recommend posting this at solspace.com - but unless Solspace has done something very unusual (and I think impossible though I’m not 100% sure on that) - you can’t break apart a tag like that using EE conditionals, you’d have to use PHP.
Try surrounding the entire form in the conditional - as a note, it’s {if segment_2}.
You could also ditch the conditionals:
form="{segment_2}_quote_request"
I’d probably go with that last option, less processing. =)
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.