Skip to content

Adding validator options #5

@roldan

Description

@roldan

There is no way to set validator options in the backend. however, there is a way to do it in > the code. Lets say you have a setting called "config_path" that you want to validate in a
certain way. In /path/to/project/lib/form/doctrine/csSettingsPlugin/csSettingForm.class.php > you can declare a public method like this:

 public function getConfigPathSettingValidator()
 {
     return new sfValidatorString(array('max_length' => 100, 'required' => true'));
 }

Or whatever validation you would like. This allows you to customize validation for certain > > settings."

Is that helpful?

Yes, it is good that way but I served in this case. I have type settings "upload"and I need to define "mime_types" and "validated_file_class" different options for each setting. I think I'll add one more field to the model: "validator_options"

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions