Forum

Thread tagged as: Question, Addons, Forms

Form Checkbox

I am trying to add check-boxes to my form and I don't really know what I am doing. The form is working and submits all the other sections (name, email, message) I set it up like this. (see below)

I want to be required to check off one, have the ability to check more than one, and record the submission. Right now, I can check them off but when I press submit it doesn't record the check-boxes.

    <h2><perch:content id="heading" type="text" label="Heading" required="true" /></h2>
<perch:form id="form-contact" method="post" app="perch_forms" role="form">
    <div class="input<perch:error for="name" type="required"> error</perch:error>">
        <perch:label for="name">Name:</perch:label>
        <perch:input id="name" type="text" required="true" label="Name" />
        <perch:error for="name" type="required">
        <p class="about-error">Please enter your name.</p>
        </perch:error>
    </div>

    <div class="input<perch:error for="email" type="required"> error</perch:error><perch:error for="email" type="format">error</perch:error>">
        <perch:label for="email">Email:</perch:label>
        <perch:input id="email" type="email" required="true" label="Email" />
        <perch:error for="email" type="required">
        <p class="about-error">Please enter your email.</p>
        </perch:error>
        <perch:error for="email" type="format">
        <p class="about-error">Please enter a valid email.</p>
        </perch:error>
    </div>

    <div class="input<perch:error for="project" type="required"> error</perch:error>">
        <perch:label for="project">Project Type</perch:label>
        <perch:input id="project" type="checkbox" name="Branding" value="Branding" /> Branding<br>
         <perch:input id="project" type="checkbox" name="Graphic-Design" value="Graphic-Design" /> Graphic Design<br>
        <perch:input id="project" type="checkbox" name="Web-Design" value="Web-Design" /> Web Design<br>
        <perch:input id="project" type="checkbox" name="other" value="other" /> other<br>

        <perch:error for="project" type="required">
        <p class="about-error">Please select a project type.</p>
        </perch:error>
    </div>


    <div class="input<perch:error for="message" type="required"> error</perch:error>">
        <perch:label for="message">Description</perch:label>
        <perch:input id="message" type="textarea" required="true" label="Message" />
        <perch:error for="message" type="required">
        <p class="about-error">Please enter your message.</p>
        </perch:error>
    </div>

    <perch:input class="button button-color2" type="submit" id="sumbit" value="send" />

    <perch:success>
        <div class="alert successs">
            <perch:content id="success" type="textarea" size="m" label="Thank you message" markdown="true" editor="simplemde" required="true" />
        </div>
    </perch:success>


</perch:form>
Sara Apfelbaum

Sara Apfelbaum 0 points

  • 3 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

Your fields need to have distinct IDs - at the moment they all have the same ID.

Thank you so much! Can't believe it was so basic and I totally missed it!