We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 38318
    • 128 Posts
    I've created a contact form using formit. All works fine but I can't get the submit button to style.
    Here's my code:
                    <article class="col-2">
                    	<h3 class="p1">Contact Form</h3>
    [[!FormIt?  
        &hooks=`spam,email,FormItAutoResponder,redirect`  
        &emailTo=`xx`  
        &emailSubject=`Website enquiry`
        &emailFromName=`[[+name]]`
        &emailTpl=`ContactTpl`
        &store=`1`
        &redirectTo=`3`  
        &fiarTpl=`ConfirmationTpl`
        &fiarSubject=`Thank you for contacting`
        &fiarFromName=`xx`
    ]]
    
    <div class="error">[[+fi.error.error_message]]</div>
    
    <form action="[[~[[*id]]]]" method="post" id="contact-form">
    
    <fieldset>
    <input type="hidden" name="nospam:blank" value="" />
    
    <label for="name"><span class="text-form">Your Name:</span>
    <input type="text" name="name:required" id="name" value="[[+fi.name]]" /></label>
    <span class="error">[[+fi.error.name]]</span>
    
    
    <label for="email"><span class="text-form">Your Email:</span>
    <input type="text" name="email:required" id="email" value="[[+fi.email]]"/></label>
    <span class="error">[[+fi.error.email]]</span>
    
                                  <div class="wrapper">
                                    
                                    <div class="text-form">
                                    <label for="message"><span class="text-form">Your Message:</span>
                                    <span class="error">[[+fi.error.message]]</span>
                                    </div>
                                    <div class="extra-wrap">
                                    <textarea name="message:required:stripTags" id="message">[[+fi.message]]</textarea>
    
                                        <div class="clear"></div>
                                        <div class="buttons">
                                            <input type="reset" value="Clear" class="button-2"/>
                                            <input type="submit" value="Send" class="button-2"/>
    
                                        </div> 
                                    </div>
                                  </div>                            
                            </fieldset>


    The Submit buttons won't style using the button-2 css I've created. I did manage to get it to style but then the button didn't work.

    Here's my button-2 css:
    .button-2 {
    	display:inline-block; 
    	padding:12px 19px;
    	font-size:13px;
    	line-height:1.23em;
    	color:#fff; 
    	background:url(../images/button2-tail.gif) 0 0 repeat-x #779f02;
    	cursor:pointer;
    }


    Is there something I'm doing wrong?
    • I'm no CSS guru by any means but I sometimes find this happens because there's a need to be more specific in the CSS reference, for example, instead of using:

      .button-2 {
          display:inline-block; 
          padding:12px 19px;
          font-size:13px;
          line-height:1.23em;
          color:#fff; 
          background:url(../images/button2-tail.gif) 0 0 repeat-x #779f02;
          cursor:pointer;
      }

      Try:

      #contact-form .button-2 {
          display:inline-block; 
          padding:12px 19px;
          font-size:13px;
          line-height:1.23em;
          color:#fff; 
          background:url(../images/button2-tail.gif) 0 0 repeat-x #779f02;
          cursor:pointer;
      }
        Garry Nutting
        Senior Developer
        MODX, LLC

        Email: [email protected]
        Twitter: @garryn
        Web: modx.com
        • 38318
        • 128 Posts
        Thanks for that, great solution! Works fine now. I knew it had to be something simple
          • 22427
          • 793 Posts
          The keyword is specificity.