0

Is there a way to create a matching email address field? I want to create a "confirm email" field to ensure the user is correctly inputting his/her email. I'm using the form composer as well, so I'm hoping there's an easy way to set this up versus having to manually create a form template and manually create each form field. Thanks!

0

There is the 'matching_fields' parameter which allows you to do just that. See the documentation for details: http://www.solspace.com/docs/freeform/form/

1
  • Is there a way to do this through the form composer? I have a lot of fields, so I don't want to have to code in all the fields manually just to do this.I tried to create a conditional, but the label and fields don't publish correctly. – user3092 Aug 14 '14 at 19:32
0

Unfortunately it's not possible to add a matching field requirement when using the Freeform Composer, unless you have a situation where:

  1. you know the exact names of the fields that would need to match, which you could hard-code in a custom Composer Template, or
  2. you know that for your form, all field of a specific fieldtype (eg. all text inputs) would all require a matching field, which in this case you would also need to create a custom Composer Template.

You will also need the matching_fields="" parameter.

For 1, you would create a custom Composer Template (either through the CP or by using {exp:freeform:composer} as a tag pair, see documentation), and add something like the following where appropriate:

...
{if:else} {!-- snippet code from default Composer Template --}
    {if composer:field_name == "email"}
        <input type="text" name="email" value="" />
        <input type="text" name="email_confirm" value="" />
    {if:else}
        <p>{composer:field_output}</p>
    {/if}
{/if}

As you can see, you would need to know the name of the field beforehand. It's not automagic.

For 2, the approach is similar, but using {composer:field_type} instead of {composer:field_type}

Of course both approaches are not "set and forget" ways of adding this functionality when using Composer. I recommend submitting this as a Feature Request under the specific add-on category. It'll also give other users the option to vote up the feature request, and help us prioritize features to add in upcoming versions of this add-on:

http://support.solspace.com/support/discussions

3
  • I have a situation like the first one. I'm just trying to match the email address. I tried to do what you said, but I can't get it to work. Is there something I'm doing wrong? I've uploaded a screenshot of the section of the code. [link]tinyurl.com/kym22k7 – user3092 Aug 19 '14 at 23:43
  • Your conditional is in the nonfield_captcha conditional (which is for the captcha field), i.e. it's in the wrong place. It should be inside {if:else}<p>{composer:field_output}</p>{/if} – Solspace Aug 19 '14 at 23:50
  • Okay, I got it to sort of work. But the problem is that I can't get the formatting to look right and the labels don't show. This is how it's looking (I want the label to say "Confirm Email" above the confirm email field). tinyurl.com/nd9suzh I tried to create a conditional so that when the field name email shows, I can just manually the email and confirm email label and fields to show, but I don't know how to stop the email field from outputting in the composer:field_output. Is this even the way to go about it? – user3092 Aug 20 '14 at 19:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.