Entry Form Validation on Front End Form I have a front end form based on the entry form example provided by craft documentation which allows logged in users to submit an entry to a specific section. Form validation is not working in that required fields are not being picked up on submission. So if the field is empty it still submits the form.

I have the user group set up so users are not able to use the CP or submit live entries so the entry is sent through as disabled so that the admin users can monitor entries before enabling them.

Am I correct in thinking that because the entry is being saved as disabled that craft does not validate the post data? If this is correct what is the work around as I do not want users to be able to post live entries.

Cheers
You're correct. Craft will not run validation upon saving disabled elements.

This is not a bug – it's just designed that way (as far as I can tell from looking at the relevant source code in the ElementsService).

As for a workaround – you'll need a plugin.

This is the easiest approach I can think of:


Listen for the entries.onBeforeSaveEntry event
In the event handler, validate the entry model manually, if the entry is disabled
If validation fails, add error messages to the model and set the $event object's performAction attribute to false


This should stop the entry from going through, and should also display any error messages in your form:

craft()-&gt;on('entries.beforeSaveEntry',function(){
    $entry = $event-&gt;params['entry'];
    if(!$entry-&gt;enabled &amp;&amp; !craft()-&gt;content-&gt;validateContent($entry))
    {
        $entry-&gt;addErrors($entry-&gt;getContent()-&gt;getErrors());
        $event-&gt;performAction = false;
    }
    return $event;
});


Anyway, since I wanted to test the above before responding here, I wrote the plugin. It seems to do the job, so hopefully it'll help you out!

https://github.com/mmikkel/AlwaysValidate-Craft