php - Why `set_radio` doesn't work when "form_validation" is included? -


i calling view

function index() {     $this->load->helper("form");     $this->load->library("form_validation");      $this->load->view("index"); } 

and have

<?php echo form_open(); ?>  <input type="radio" name="radioname" value="x" <?php echo set_radio("radioname", "x", true); ?> /> <input type="radio" name="radioname" value="y" <?php echo set_radio("radioname", "y"); ?> />  </form> 

at first load first radio checked. if post form value goes $this->input->post(). none of radio boxes checked. if don't load validation code works.

i dug code , found if form_validation loaded behaves differently.

$obj =& _get_validation_object();  if ($obj === false) {     // returns formhelper set_radio }  // doesn't make sense me return $obj->set_radio($field, $value, $default); 

if form_validation loaded executes set_radio $obj, doesn't work.

what $obj in context? have change make work?

you need add fake rule radioname like

$this->form_validation->set_rules("radioname", "", "trim"); 

Comments

Popular posts from this blog

linux - xterm copying to CLIPBOARD using copy-selection causes automatic updating of CLIPBOARD upon mouse selection -

c++ - qgraphicsview horizontal scrolling always has a vertical delta -