• It would be cool if for adding a new field input type text you could provide 2 additional fields. First field would take a regular expression string, another just a text for an error when the value does not pass regular expression.

    This way, those who know power of regular expressions could provide for fields a good checking of the inputted data (you could also provide a drop down with most common like numbers only, one numbers, emails, website, etc). However, just a custom regular expression would be very cool, most programmers could make up their own one.

    I think this would make this plugin a much more powerful one since it would allow field data checking.

    https://www.ads-software.com/extend/plugins/custom-field-suite/

Viewing 2 replies - 1 through 2 (of 2 total)
  • This would be cool.

    I like the idea — validation is something we’re going to need.

    Instead of adding validation logic to each field, would you be OK with some sort of validation hook? For example:

    add_filter('cfs_validators', 'my_custom_validator');
    
    function my_custom_validator($validators) {
        $validators['valid_email'] = array(
            'label' => 'Valid Email',
            'field_types' => array('text'),
            'logic' => 'is_valid_email', // function name or regex
            'error_text' => 'Please enter a valid email for {@label}',
        );
        return $validators;
    }

    That way, we could add validators that can be applied to multiple fields, and multiple field types.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘[Plugin: Custom Field Suite] Feature request – reg expressions’ is closed to new replies.