Welcome Guest, Not a member yet? Register   Sign In
Form validation error delimiter
#2

(This post was last modified: 12-18-2016, 04:44 PM by PaulD. Edit Reason: clarification )

Yes, you can do it like this, just before you set your validation rules in your controller you can add this:

PHP Code:
$this->form_validation->set_error_delimiters(''''); 

(Those are empty single quotes by the way). Or you can add whatever you need on a case by case basis:

PHP Code:
$this->form_validation->set_error_delimiters('<span>''</span>'); 

This will overide the config settings. I normally have config set to something general like you have, then overide for different uses or layouts or stylings as needed per form with the above.

You can also set delimeters individually for each error message in the view if you need to mix and match them in one form.

PHP Code:
<?php echo form_error('field name''<div class="error">''</div>'); ?>

It is here in the docs:

https://www.codeigniter.com/user_guide/l...delimiters

Hope that helps,

Paul.
Reply


Messages In This Thread
Form validation error delimiter - by mla - 12-18-2016, 02:32 PM
RE: Form validatiion error delimiter - by PaulD - 12-18-2016, 04:42 PM
RE: Form validatiion error delimiter - by mla - 12-19-2016, 08:52 AM



Theme © iAndrew 2016 - Forum software by © MyBB