0

Based on EE documentation to have multiple required fields I need to make the name= attribute an array by using "required[]" but when I do that those fields still are not required (no errors returned).

Form code looks like:

        {exp:email:contact_form user_recipients="no" recipients="myemail@domain.com" charset="utf-8"}
        <div class="col-md-6">
            <fieldset id="contact_details">
            <table class="table table-hover">
            <tbody>
            <tr><td>
            <div class="form-group">                
            <label class="col-md-3 control-label" for="company">Company Name <span class="required">*</span></label> 
            <div class="col-md-9"><input type="text" class="input-text required-entry" value="" title="Company Name" id="company" name="required[]"></div>
            </div>
            </td></tr>
            <tr><td>
            <div class="form-group">                
            <label class="col-md-3 control-label" for="fname">First Name <span class="required">*</span></label> 
            <div class="col-md-9"><input type="text" class="input-text required-entry" value="" title="First Name" id="fname" name="required[]"></div>
            </div>
            </td></tr>
            <tr><td>
            <div class="form-group">                
            <label class="col-md-3 control-label" for="name">Last Name <span class="required">*</span></label> 
            <div class="col-md-9"><input type="text" class="input-text required-entry" value="" title="Last Name" id="name" name="required[]"></div>
            </div>
            </td></tr>
            <tr><td>
            <div class="form-group">
            <label class="col-md-3 control-label" for="address1">Address <span class="required">*</span></label> 
            <div class="col-md-9"><input type="text" class="input-text required-entry" value="" title="Address" id="address1" name="required[]"></div>
            </div>
            </td></tr>
            <tr><td>
            <div class="form-group">
            <label class="col-md-3 control-label" for="address2">Address 2</label> 
            <div class="col-md-9"><input type="text" class="input-text" value="" title="Address 2" id="address2" name="address2"></div>
            </div>
            </td></tr>
            <tr><td>
            <div class="form-group">
            <label class="col-md-3 control-label" for="city">City <span class="required">*</span></label>
            <div class="col-md-9"><input type="text" class="input-text required-entry" value="" title="City" id="city" name="required[]"></div>
            </div>
            </td></tr>
            <tr><td>
            <div class="form-group">
            <label class="col-md-3 control-label" for="state">State/Province <span class="required">*</span></label> 
            <div class="col-md-9">                
                            <select class="required-entry" id="state" name="required[]">
                            <option value="">State/Province</option>
                            <option value="AL">Alabama</option>
                            <option value="AK">Alaska</option>
                            <option value="AZ">Arizona</option>
                            <option value="AR">Arkansas</option>
                            <option value="CA">California</option>
                            <option value="CO">Colorado</option>
                            <option value="CT">Connecticut</option>
                            <option value="DC">District of Columbia</option>
                            <option value="DE">Delaware</option>
                            <option value="FL">Florida</option>
                            <option value="GA">Georgia</option>
                            <option value="HI">Hawaii</option>
                            <option value="ID">Idaho</option>
                            <option value="IL">Illinois</option>
                            <option value="IN">Indiana</option>
                            <option value="IA">Iowa</option>
                            <option value="KS">Kansas</option>
                            <option value="KY">Kentucky</option>
                            <option value="LA">Louisiana</option>
                            <option value="ME">Maine</option>
                            <option value="MD">Maryland</option>
                            <option value="MA">Massachusetts</option>
                            <option value="MI">Michigan</option>
                            <option value="MN">Minnesota</option>
                            <option value="MS">Mississippi</option>
                            <option value="MO">Missouri</option>
                            <option value="MT">Montana</option>
                            <option value="NE">Nebraska</option>
                            <option value="NV">Nevada</option>
                            <option value="NH">New Hampshire</option>
                            <option value="NJ">New Jersey</option>
                            <option value="NM">New Mexico</option>
                            <option value="NY">New York</option>
                            <option value="NC">North Carolina</option>
                            <option value="ND">North Dakota</option>
                            <option value="OH">Ohio</option>
                            <option value="OK">Oklahoma</option>
                            <option value="OR">Oregon</option>
                            <option value="PA">Pennsylvania</option>
                            <option value="RI">Rhode Island</option>
                            <option value="SC">South Carolina</option>
                            <option value="SD">South Dakota</option>
                            <option value="TN">Tennessee</option>
                            <option value="TX">Texas</option>
                            <option value="UT">Utah</option>
                            <option value="VT">Vermont</option>
                            <option value="VA">Virginia</option>
                            <option value="WA">Washington</option>
                            <option value="WV">West Virginia</option>
                            <option value="WI">Wisconsin</option>
                            <option value="WY">Wyoming</option>
                            </select>
                   </div>
            </div>
            </td></tr>
            <tr><td>
            <div class="form-group">
            <label class="col-md-3 control-label" for="zip">Postal Code <span class="required">*</span></label>
            <div class="col-md-9"><input type="text" class="input-text required-entry" value="" title="Postal Code" id="zip" name="required[]"></div>
            </div>
            </td></tr>                
        </tbody>
        </table>
        </fieldset>
        </div>

        <div class="col-md-6">
        <fieldset id="contact_details">
        <table class="table table-hover">
        <tbody>            
            <tr><td>
            <div class="form-group">
            <label class="col-md-3 control-label" for="telephone">Telephone <span class="required">*</span></label>
            <div class="col-md-9"><input type="text" class="input-text required-entry" value="" title="Telephone" id="telephone" name="required[]"></div>
            </div>
            </td></tr>    
            <tr><td>
            <div class="form-group">
            <label class="col-md-3 control-label" for="telephone2">Telephone (Alternative)</label>
            <div class="col-md-9"> <input type="text" class="input-text" value="" title="Telephone Alternative" id="telephone2" name="telephone2"></div>
            </div>
            </td></tr>    
            <tr><td>
            <div class="form-group">
            <label class="col-md-3 control-label" for="from">Email <span class="required">*</span></label>
            <div class="col-md-9"><input type="text" class="input-text required-entry validate-email" value="" title="from" id="from" name="from"></div>
            </div>
            </td></tr>    
            <tr><td>
            <div class="form-group">
            <label class="col-md-3 control-label" for="message">ADD A NOTE <span class="required">*</span></label>
            <div class="col-md-9"><textarea rows="3" cols="5" style="height:150px;" class="input-text" title="Message" id="message" name="message"></textarea></div>
            </div>
            </td></tr>    
        </tbody>
        </table>
        </fieldset>

        <div class="form-group">
            <input type="submit" style="margin-right:7px;" class="btn btn-block btn-plain pull-right" value="Submit" name="submit">
        </div>

        </div>
        {/exp:email:contact_form}

Any clue what is going on? Or maybe I should to use off the shelf extension like Solspace Freeforms?

1

The Email Contact Form doesn't support custom fields other than the defaults of:

  • From
  • To
  • Subject
  • Name
  • Message
  • Captcha

By the looks of your example you're looking to include a lot more than that.

Solspace Freeform is a popular option but there are other notable options which may be a better fit for your needs including DevDemon Forms and ProForm. They're certainly worth investigating and generally with the power of these addons and the FreeForm being...well...free, the default Email Contact Form is something which I don't see used very often.

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.