set_message() from form_validation |
Hi guys,
I can't understand how to use set_message() form from_validation libraries. I've read doc, consult stackoverflow and I can't figure it out on how to use it... What I'm trying to achieve (for now) is checking if a checkbox is cheked or not... PHP Code: /*just output the page where user can compile a form*/ This is the part in nuovocosplay.php view that call the checkbox and the error Code: <?php echo form_error('accetta_misure', '<div class="error">', '</div>'); ?> PHP Code: /*this is the validation that call the misure_db model function to write data to DB*/ I really don't understand what's wrong, I've read that I have to use callbacks? but how... Thank you in advance and sorry for my noobness
A callback is just another function / method in you code.
function checkbox_callback(){} You then need to add the callback function / method name to the set_rule What did you Try? What did you Get? What did you Expect?
Joined CodeIgniter Community 2009. ( Skype: insitfx )
(02-25-2016, 06:41 AM)InsiteFX Wrote: A callback is just another function / method in you code. yes...I've already used a callback for my login system...the problem is that I don't know what code to write in the callback if I've already coded the check in the misure_validation() PHP Code: /*Invio dati al modello per l'inserimento dei dati nel db*/ I'm trying anything and nothing seems to work
02-25-2016, 10:04 AM
(This post was last modified: 02-25-2016, 10:06 AM by davicotico. Edit Reason: Fix ) (02-25-2016, 09:47 AM)Psygnosis Wrote: Here is a little example with checkbox: Controller: (Welcome.php) PHP Code: public function index() PHP Code: <body> (02-25-2016, 11:34 AM)Psygnosis Wrote: but you don't set a custom error message in your example PHP Code: // If you need to set a custom error message for a particular field on some particular rule, use the set_rules() method: What did you Try? What did you Get? What did you Expect?
Joined CodeIgniter Community 2009. ( Skype: insitfx )
|
Welcome Guest, Not a member yet? Register Sign In |