CodeIgniter Forums
Form Validation for Input Radio - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Development (https://forum.codeigniter.com/forumdisplay.php?fid=6)
+--- Forum: CodeIgniter 2.x (https://forum.codeigniter.com/forumdisplay.php?fid=18)
+--- Thread: Form Validation for Input Radio (/showthread.php?tid=911)



Form Validation for Input Radio - cakka - 01-28-2015

Helo,

I get a problem with my codes.

I am creating a codes to do edit the data. If user edit the data, it should perform a validation. If it is return false, it will back to the form and give a notification. The submitted value in the field will be return in the form. But, it didn't return the submitted value in input radio.

What wrong with my codes ?

Please give me to solve this problem.


This is my codes for

- the controller : http://pastebin.com/HY2XrX5w

- the models : http://pastebin.com/YF8igE3R

- the views : http://pastebin.com/41N48rZx


Thank you


RE: Form Validation for Input Radio - FaraonX - 01-29-2015

Hmm on first look... Try this:

PHP Code:
'published' => array(
 
         'name'        => 'product_status',
 
         'id'  => 'product_status',
 
   'value'     => 1,
 
   'checked'   => if($form_value['product_status'] == 1){ TRUE } else { FALSE }
 
 ),
 
 'notpublished' => array(
 
         'name' => 'product_status',
 
         'id' => 'product_status',
 
   'value'     => 0,
    
'checked'   => if($form_value['product_status'] == 0){ TRUE } else { FALSE }
 
 ),