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

Projects
None yet
3 participants
@Zetzumarshen
Copy link
Contributor

Zetzumarshen commented Nov 17, 2016

No description provided.

Zetzumarshen added some commits Nov 17, 2016

following codeigniter 3, adding custom error message as fourth argume…
…nt to set_rules(), db_insert_validation(), and db_update_validation()
Update Grocery_CRUD.php
following codeigniter 3, adding custom error message as fourth argument to set_rules()
@adc91

This comment has been minimized.

Copy link

adc91 commented Dec 1, 2016

how to use?

@Zetzumarshen

This comment has been minimized.

Copy link
Contributor

Zetzumarshen commented Dec 4, 2016

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

This comment has been minimized.

Copy link
Owner

scoumbourdis commented Jan 8, 2017

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