Form field validation I am relatively new to Craft CMS and have been using the formBuilder2 plugin to create forms. No problem this far. I have been able to use ElementApi to output the forms into Json. Still no problem.
My issue starts when I have to add validation to my form fields. I have read the "The Definitive Guide to Craft Validation for Plugin Developers (The Book)" and I am still very much confused as to how I actually implement validation on specific field in my form. In a nutshell, how can I add a email validator to an field that I named email. Also, how do I implement this to the fieldset if all I have to go with is:

        {% set fields = tab.getFields() %}
        &lt;fieldset class="{{ tab.name |lower|replace(' ', '-') }}"&gt;
            &lt;legend&gt;{{ tab.name }}&lt;/legend&gt;
            {% for field in fields %}
            {% set input = craft.formBuilder2.getInputHtml(field) %}
            {{ input | raw }}
            {% endfor %}
        &lt;/fieldset&gt;
        {% endfor %}


Not to sound silly but why, why, why why????
Please can someone help me....
The controller you're posting to is responsible for the validation. In the case of the entries/saveEntry controller for example there's an Entry model populated and then run through the validation. Each model attribute and all the fields (content) have to give their ok for the complete model to validate correctly.

For the fields it's the field type's attribute type and an optional validate method that are responsible. Have a look at this plugin by Marion Newlevant, it provides a simple field type with configurable validation and is probably a good example for what you're trying to achieve.

https://github.com/marionnewlevant/craft-mn_matchinput