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

Adding custom error message for set_rules() #382

Merged
merged 2 commits into from
Jan 8, 2017

Conversation

Zetzumarshen
Copy link
Contributor

No description provided.

…nt to set_rules(), db_insert_validation(), and db_update_validation()
following codeigniter 3, adding custom error message as fourth argument to set_rules()
@adc91
Copy link

adc91 commented Dec 1, 2016

how to use?

@Zetzumarshen
Copy link
Contributor Author

This is how to pass custom error messages for CI3

For Grocery CRUD:

$crud = new Grocery_Crud();
$crud->set_table('customers');

$crud->columns('customerName','phone','addressLine1','creditLimit');
$crud->set_rules('customerName', 'Customer Name', 'rule1|rule2|rule3',
        array('rule2' => 'Error Message on rule2 for this field_name')
);

$output = $crud->render();
 
$this->_example_output($output);

In PHP tested in (4, 5.3, 7.*), a function will ignore any extra argument that it expects, so it should be backward compatible.

@scoumbourdis scoumbourdis merged commit 31f4e6d into scoumbourdis:master Jan 8, 2017
@scoumbourdis
Copy link
Owner

Yeap! I agree! Pretty safe change. Thanks for the pull request. Merged 😄

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

Successfully merging this pull request may close these issues.

3 participants