Problems, need help? Have a tip or advice? Post it here.
4 posts Page 1 of 1
I have a one page site and the contact form sends mail but i get no success message. I have tried some codeI fund here that looks promising but no luck. It just reloads the page at the top.
This is what I have so far.. any advice appreciated
Code: Select all
  
<div class="row">

        <h1>Contact Us</h1>
      
      <div class="col-md-6 col-md-offset-3
      <cms:if "<cms:get_flash 'success_msg'/>" >
    <p id='mail_success' class='success'><cms:get_flash 'success_msg' /></p>
</cms:if>
       <cms:form action='' method='post' id='contact_form' class='text-center'>
       <ul id="emailform">
            <li class="clearfix">
            
                  <label for="name">Name</label>
                  <cms:input type='text' class='text-input' name='name' id='name' required='1' class="form-horizontal feedback-input" />
              <div class="clear"></div>
              <cms:if k_error_name>
             <p id='name_error' class='error' style="display:block">Insert a name</p>
            </cms:if>
            
              </li>
   <li class="clearfix">
 
                  <label for="email">Email Address</label>
                  <cms:input type='text' class='text-input' name='email' id='email' required='1' validator='email' class="feedback-input form-horizontal" />
              <div class="clear"></div>
                <cms:if k_error_name>
                  <p id='email_error' class='error' style="display:block">Insert an email</p>
             </cms:if>
            
    </li>
                  <li class="clearfix">
            
                  <label for="message">Message</label>
                <cms:input type='textarea' class='text-input' name='message'  id='message' required='1' rows='8' class="feedback-input form-horizontal"></cms:input>
               <div class="clear"></div>
              <cms:if k_error_name>
            <p id='mesage_error' class='error' style="display:block">Insert a message</p>
            </cms:if>
          
                </li>
            </ul>
              <cms:if k_success >   
        <cms:send_mail from=k_email_from to=k_email_to subject='Feedback from your site'>
            The following is an email sent by a visitor to your site :
            <cms:show k_success />
        </cms:send_mail>
       
        <cms:set_flash name='success_msg' value="Thank you. We will get back to you as soon as possible." />
        <cms:redirect k_page_link />
    </cms:if>
            <div class="clearfix"></div>
               <input type='submit' id='send_message' class="btn btn-default " value='Submit' />
               </cms:form>
         
        </div>
The main problem is that the following DIV in your code is malformed and hence causing the message P to disappear -
Code: Select all
<div class="col-md-6 col-md-offset-3

Following is the rectified code -
Code: Select all
<div class="row">

    <h1>Contact Us</h1>

    <cms:if "<cms:get_flash 'success_msg'/>" >
        <p id='mail_success' class='success'><cms:get_flash 'success_msg' /></p>
    <cms:else />
        <h3>no flash</h3>
    </cms:if>


    <cms:form action='' method='post' id='contact_form' class='text-center'>
        <ul id="emailform">
            <li class="clearfix">

                <label for="name">Name</label>
                <cms:input type='text' class='text-input' name='name' id='name' required='1' class="form-horizontal feedback-input" />
                <div class="clear"></div>
                <cms:if k_error_name>
                    <p id='name_error' class='error' style="display:block">Insert a name</p>
                </cms:if>

            </li>
           
            <li class="clearfix">

                <label for="email">Email Address</label>
                <cms:input type='text' class='text-input' name='email' id='email' required='1' validator='email' class="feedback-input form-horizontal" />
                <div class="clear"></div>
                <cms:if k_error_email>
                    <p id='email_error' class='error' style="display:block">Insert an email</p>
                </cms:if>

            </li>
           
            <li class="clearfix">

                <label for="message">Message</label>
                <cms:input type='textarea' class='text-input' name='message'  id='message' required='1' rows='8' class="feedback-input form-horizontal"></cms:input>
                <div class="clear"></div>
                <cms:if k_error_message>
                    <p id='mesage_error' class='error' style="display:block">Insert a message</p>
                </cms:if>

            </li>
        </ul>

        <cms:if k_success >   
            <cms:send_mail from=k_email_from to=k_email_to subject='Feedback from your site'>
                The following is an email sent by a visitor to your site :
                <cms:show k_success />
            </cms:send_mail>

            <cms:set_flash name='success_msg' value="Thank you. We will get back to you as soon as possible." />
            <cms:redirect k_page_link />
        </cms:if>

        <div class="clearfix"></div>
        <input type='submit' id='send_message' class="btn btn-default " value='Submit' />
    </cms:form>

</div>

I have also rectified the <cms:if k_error_email> and <cms:if k_error_message> statements which were previously duplicated as <cms:if k_error_name>.

Hope it helps.
Hi. It still does not display the success message when the message sends :(
ah found the problem. had an old css class from before having display:none on the success class. :D woop
4 posts Page 1 of 1