Support » Plugin: Custom Field Suite » New field type email and validate it

Viewing 3 replies - 1 through 3 (of 3 total)
  • Can plugin author reply on this please? I want to extend and add new field in CFS.

    Plugin Author Matt Gibbs


    I still need to add another hook before custom validation can be used.

    There’s a cfs_custom_validation hook where you define the validation rules, but there needs to be another hook (line ~313 of form.php) to allow you to “attach” a custom rule to fields.

    Here’s an example of the cfs_custom_validation hook.

    function prefix_cfs_custom_validation() {
    (function($) {
        $(function() {
            CFS.validators['valid_email']: {
                'error': 'Please enter a valid email',
                'validate': function(val) {
                    var regex = "THE EMAIL VALIDATION REGEX";
                    return regex.test(val);
            CFS.get_field_value['email'] = function(el) {
                return el.find('input').val();
    add_action( 'cfs_custom_validation', 'prefix_cfs_custom_validation' );

    So you are saying, I need to wait for another version (after adding another hook) to use the above code?

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘New field type email and validate it’ is closed to new replies.