Contact Form Plugin: Validate if a checkbox is checked? What is the cleanest way to validate if a checkbox (i.e. agree to legal terms) is checked?
There's no clean way doing this without making changes to the plugin itself. The  contactForm.beforeSend event makes it possible to prevent the email from being sent from another plugin, but you're only being passed the compiled email message as a string. It's probably possible to post you checkbox data with that string and parse for it in your event listener, but you asked for a clean solution! :)

So fork the plugin and add a new attribute to the ContactFormModel:

'agreedToTerms' =&gt; array(AttributeType::Enum, 'required' =&gt; true, 'values' =&gt; array(true)),


And make the ContactFormController get the attribute value from your form:

$message-&gt;agreedToTerms = craft()-&gt;request-&gt;getPost('agreedToTerms');


You're now all set add a checkbox "agreedToTerms" to your form and add a custom error message in case the model attribute failed validation:

&lt;label&gt;&lt;input type="checkbox" name="agreedToTerms" value="true" {{ message is defined and message.agreedToTerms ? 'checked' }}&gt; Agree the Terms and Conditions&lt;/label&gt;

{% if message is defined and message.hasErrors('agreedToTerms') %}
    &lt;ul class="errors"&gt;&lt;li&gt;{{ 'You must agree the Terms and Conditions'|t }}&lt;/li&gt;&lt;/ul&gt;
{% endif %}