Support » Plugin: Contact Form 7 » [Plugin: Contact Form 7] How to set an array for multiple/duplicate fields? 'Array' in ema

  • In need of some immediate help! I have a javascript that creates new fields when a user needs to make multiple responses for medical histories. Inside each new <fieldset> is a combobox & text field…I’m utilizing this module for another <fieldset> that just contains a text field.

    My email goes through and the first <fieldset>, ‘Medical Conditions’ comes through without too much issue (aside from each response coming through as:

    Medical Conditions: Heart Disease, GERD, Acid Reflux
    How long afflicted: 12 years, 5 months, 2 years

    ..but one thing at a time).

    Now, the second <fieldset> ‘Medications’, however, only returns the response ‘Array’. I’m not sure why the first works, but not the second…but what should I do? Is there some way to set up javascript to cycle through the array, or am I doing something wrong in my code?


    				<legend>Medical Condition(s): (Click '+' to Add, '-' to Delete)</legend>
    				<fieldset id="duplicate">
    				<legend>Choose Condition and Affliction Period: </legend>
    				<p><label for="condition">Condition: </label>[select condition id:condition "Acid Reflux Disease (GERD)" "Acne" "Allergies" "Attention Deficit Disorder" "Alzheimer's Disease" "Anorexia Nervosa" "Arthritis" "Asthma" "Back Pain" "Bipolar Disorder (BD)" "Brain Injury" "Bronchitis" "Bulimia" "Bursitis" "Cancer" "Celiac Disease" "Cholesterol" "Chronic Obstructive Pulmonary Disease (COPD)" "Congestive Heart Failure (CHF)" "Crohn's Disease" "Depression" "Diabetes" "Diarrhea" "Disabilities" "Diverticulitis" "Ear Infections" "Ear Problems" "Eczema" "Endometriosis" "Enlarged Prostate" "Epilepsy (Seizure)" "Erectile Dysfunction (ED)" "Eye Problems" "Fibromyalgia" "Gallbladder Disease" "Gallstones" "Generalized Anxiety Disorder" "Genital Herpes" "Glomerulonephritis (Nephritis)" "Gout" "Headache" "Hearing Loss" "Heart Disease" "Heartburn" "Hemorrhoids" "Hepatitis" "Herniated Discs" "Hiatal Hernia" "HIV/AIDS" "High Blood Sugar: Hyperglycemia" "High Blood Pressure" "Hyperkalemia: High Potassium" "Hyperthyroidism" "Hypothyroidism" "Infertility" "Insulin Dependent Diabetes Mellitus (IDDM)" "Iron Deficiency Anemia" "Irritable Bowl Syndrome (IBS)" "Itching" "Juvenile Diabetes" "Juvenile Rheumatoid Arthritis" "Kidney Diseases" "Kidney Stones (Renal Calculi)" "Lupus" "Memory Loss" "Menopause" "Mesothelioma" "Migraine" "Multiple Sclerosis (MS)" "Muscle Cramps" "Muscle Fatigue" "Muscle Pain" "Obesity" "Osteoarthritis (OA)" "Osteomyelitis" "Osteoporosis" "Ovarian Cancer" "Ovarian Cyst" "Pain" "Parkinson's Disease (PD)" "Peripheral Artery Disease (PAD)" "Peptic Ulcers" "Polio" "Pneumonia" "Post Nasal Drip" "Post Traumatic Stress Disorder" "Premenstrual Syndrome (PMS)" "Psoriasis" "Renal Failure" "Restless Legs Syndrome (RLS)" "Rheumatoid Arthritis (RA)" "Ringworm" "Rosacea" "Sciatica" "Schizophrenia" "Sinus Infections" "Skin Rash or Hives" "Sleep Disorders (Sleep Apnea)" "Snoring" "Staph Infection (MRSA)" "Tuberculosis (TB)" "Ulcers" "Urinary Tract Infection (UTI)" "Varicose Veins" "Vertigo" "Yeast Infection (Candidiasis)" "Other"]</p>
    				<p><label for="monthsyearsnumber">Approximately: </label>[select monthsyearsnumber id:monthsyearsnumber "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11+"][select monthsyears id:monthsyears "Months" "Years"]</p>
    <p><label for="typelocationother">Type/Location/Other: </label>[text typelocationother id:typelocationother]</p>
                    <p><span><a id="minus" href="">[-]</a> <a id="plus" href="">[+]</a></span></p>


    				<legend>Medication(s): (Click '+' to Add, '-' to Delete)</legend>
    				<fieldset id="duplicate2">
    				<legend>If 'Yes', please list Medication(s):</legend>
                                    <p>[text medicationslist id:medicationslist]</p>
    				<p><span><a id="minus2" href="">[-]</a> <a id="plus2" href="">[+]</a></span></p>

    As you will notice, the ‘duplicate’ id’s are unique to each <fieldset> so that shouldn’t be an issue, its just for the javascript to identify the fields to duplicate using the ‘+’ or remove with the ‘-‘.

    What could I be doing wrong here to get a decent response for one, but ‘Array’ for the other??

    Thanks to any and all who can help, and the sooner the better!! 🙂

Viewing 6 replies - 1 through 6 (of 6 total)
  • CORRECTION: It seems that only the text fields are passing the ‘Array’ problem, not the combo boxes, and this is occurring in BOTH <fieldset>s not just one…if that helps at all.

    Did you ever figure this out? Trying to grab an array of text fields myself and having trouble.

    I tried contacting the plugin developer, and he hasn’t responded to anything yet. This really should be addressed as a Contact Form 7 addition, seeings how 2-dimensional contact forms are considered stone age to Web 2.0 standards.

    Having a dynamic form is essential, and if needs be, I’ll just have to work one directly onto a template page and leave Contact Form 7 to catch up with the times.

    I’ll let you know if I get anywhere, but my best advice is to look to utilizing a dynamic form code into a template page.

    My apologies…meant to leave the plugin I worked into the form. You can use the code I placed above for a reference of what to put in the CF7 interface:

    Just know that the combo boxes work perfect…the text fields are throwing the “array” problem.


    Yeah, I’ve already figured out how to add a field dynamically and I name the new textbox the same as the others, with [] so that it is an array. however, when submitted, as you are experiencing, the value returned is ‘Array’, not the actual values.

    I’m digging deep into the code right now, but so far, no luck.

    I’ll keep you posted as well, if I find anything.


    I’m also trying to get CF7 to work with form fields generated on the fly. I’ve worked out a jQuery script to provide that functionality in the browser, but I have a few questions about making it work with the CF7 plugin.

    themonko, how do you get CF7 to process a text field who’s name includes the square brackets? I’ve tried for example, [text user[first_name]], but CF7 can’t render the field.

    mrmcq, I’ve taken your advice and loaded the search and replace plugin which modifies the form CF7 builds replacing {name=”user-first_name”} with {name=”user[first_name]”}. The browser renders the form with the appropriate field names, however when CF7 processes the form, it won’t recognize a field with that name.

    A general question about CF7, is there any way to get it to recognize hand coded html elements? Other plugins support custom html forms but CF7 is pretty deeply integrated into a couple of my sites.

    Thank you for your threads so far. They’ve been helpful in getting me this far.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘[Plugin: Contact Form 7] How to set an array for multiple/duplicate fields? 'Array' in ema’ is closed to new replies.