Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add common validation rules #2

Open
yllumi opened this issue Jul 6, 2015 · 4 comments
Open

Add common validation rules #2

yllumi opened this issue Jul 6, 2015 · 4 comments
Assignees

Comments

@yllumi
Copy link
Member

yllumi commented Jul 6, 2015

Add common validation rules such as minlength, maxlength, required etc.

@ridwanbejo ridwanbejo self-assigned this Jul 6, 2015
@ridwanbejo
Copy link
Contributor

min_length, max_length, and match_length has been added

@yllumi
Copy link
Member Author

yllumi commented Jul 8, 2015

how do we use it?

@ridwanbejo
Copy link
Contributor

for example to add validation rules for CharField:


$this->last_name = [
                'fields' => 'CharField',
                'initial'=>'', 
                'config' => [
                    'placeholder' => 'isi dengan last name anda...',
                    'id' => 'last_name'
                ],
                'rules' => [
                    'min_length' => 5,
                    'max_length' => 10,
                ]
            ];    

@ridwanbejo
Copy link
Contributor

add greater_than, less_than, greater_than_equal, less_than_equal, and equal for NumberField. Here is the example usage:


$this->age = [
                'fields' => 'NumberField',
                'initial'=>'0', 
                'config' => [
                    'placeholder' => 'isi dengan age anda...',
                    'id' => 'age'
                ],
                'rules' => [
                    'less_than_equal' => 30,
                ]
            ];    
        $this->salary = [
                'fields' => 'NumberField',
                'initial'=>'0', 
                'config' => [
                    'placeholder' => 'isi dengan salary anda...',
                    'id' => 'salary'
                ],
                'rules' => [
                    'greater_than_equal' => 10000,
                ]
            ];  

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants