I'm using EE's built in e-mail module for a contact form on my site. I'd like to add additional fields to the form that it doesn't have out of the box. I know freeform by solspace will do this, but I was hoping there is a way without spending $100 on a plugin.
1 Answer
EE's contact form does not support custom fields per se (i.e., it doesn't support the custom fields you'd use for your channels), but you can have multiple fields populate the message by naming each with an array syntax:
<label for="message">Your Message</label>
<textarea name="message[]" id="message"></textarea>
<label for="how">How did you hear about us?</label>
<textarea name="message[]" id="how"></textarea>
<label for="age">How old are you?</label>
<select name="message[]" id="age">
<option value="16-20">16-20 years</option>
<option value="21-30">21-30 years</option>
<option value="31-40">31-40 years</option>
</select>
(Docs.)
I'll also point out that there is a free version of Freeform 4 which lets you add as many fields as you like to your message - just not all of the custom field types.
-
I'm also wrestling with this. I'm having difficulty getting the message[] array syntax to work with radio buttons (which all need to have the same value for the name attribute, but presumably the fact that other elements have the same name -- name="message[]" -- is confusing the result). These radio buttons are the only non-text field elements in the form, but I really don't want to have to spend $100 on Freeform Pro just to use three radio buttons in my form!– RickLApr 2, 2013 at 14:38
-
Rick - you can do what you need with Freeform Free. Just use "text" fields, but build them as radio inputs on the front-end. Apr 2, 2013 at 15:38
-
Thanks Derek. Yes, I figured that out in the end, with the help of a rather unhelpfully cryptic forum thread over at Solspace (the kind that goes "never mind, I solved it" without telling you how). however, it gave me enough info to decide that it probably could be done, and the rest was just trial and error. Your input here is greatly appreciated, nonetheless, so cheers.– RickLApr 2, 2013 at 21:41