Forum for discussing general topics related to Couch.
5 posts Page 1 of 1
Hello, I have a contact form on my index page, and when I press the submit button, nothing is working. My code is as follows.

Code: Select all
<cms:form role="form" id="contact_form" class="contact-form" method="post" onSubmit="return false">
        <!-- Form  -->
        <div class="contact-right padding-top-30 padding-left-30">
          <!-- Success Msg -->
        <cms:if k_success>
          <div id="contact_message" class="success-msg" style="display:block"> <i class="fa fa-paper-plane-o"></i>Thank You. Your Message has been submitted!</div>
        <cms:send_mail from=k_email_from to=k_email_to subject='subject'>
         <cms:show k_success />
        </cms:send_mail>
        </cms:if>
        <cms:if k_error>
          <div id="contact message" class="failure-msg" style="display:block"> <i class="fa fa-ban"></i>Please fill out the required fields.</div>
        </cms:if>
          <!-- FORM -->
            <ul class="row">
              <li class="col-sm-4">
                <label>
                  <cms:input type="text" class="form-control" name="name" id="name" placeholder="NAME" required='1' />
              <cms:if k_error_name>
              <p>Please enter your name.</p>
              </cms:if>
                </label>
              </li>
              <li class="col-sm-4">
                <label>
                  <cms:input type="text" class="form-control" name="email" id="email" placeholder="EMAIL" required='1' validator='email' />
              <cms:if k_error_email>
              <p>Please enter your email address.</p>
              </cms:if>
                </label>
              </li>
              <li class="col-sm-4">
                <label>
                  <cms:input type="text" class="form-control" name="subject" id="subject" placeholder="SUBJECT" required='1' />
              <cms:if k_error_subject>
              <p>Please enter a subject.</p>
              </cms:if>
                </label>
              </li>
              <li class="col-sm-12">
                <label>
                  <cms:input type="textarea" class="form-control" name="message" id="message" rows="5" placeholder="CONTENT..." required='1' />
              <cms:if k_error_message>
              <p>Please type a message.</p>
              </cms:if>
                </label>
              </li>
              <li class="col-sm-12">
                <cms:input type='submit' name='submit' button type="submit" value="SEND" id="btn_submit"/>
              </li>
            </ul>
          </cms:form>
        </div>
      </div>
    </section>


The code looks right to me, but I could very well be overlooking something small. Could anyone possibly tell me what I am doing wrong? thanks in advance!
Hi,

You have added some JS to the form that is preventing the submit process from completion -
<cms:form role="form" id="contact_form" class="contact-form" method="post" onSubmit="return false">

Please remove that and the form should work.
That fixed it! the form is working and submitting exactly as it should! Thanks!

Now for the email I receive in my inbox, one of the boxes on the form that a user would fill in is the subject. I want the email I get sent to me to inherit the subject from that input box.

Here is the code I have implemented to try and pull the subject from the form. Instead of getting it from the form, it just changed the subject to "frm_subject"

Code: Select all
<cms:send_mail from=k_email_from to=k_email_to subject='frm_subject'>
The correct code would be -
Code: Select all
<cms:send_mail from=k_email_from to=k_email_to subject=frm_subject>

or
Code: Select all
<cms:send_mail from=k_email_from to=k_email_to subject="<cms:show frm_subject />">

Please see http://docs.couchcms.com/concepts/setti ... eters.html if you are unclear about the importance of quotes.

Hope this helps.
Perfect! Thank you for the wonderful support as always! :mrgreen:
5 posts Page 1 of 1
cron