[eluser]tison[/eluser]
For a quick fix, I've created this function to easily set empty rules - so that all fields get re-populated:
In /helpers/MY_form_helper.php
Code:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/**
* Set empties
*
* Sets empty fields using set_value, hopefully they will fix this
*
*/
if ( ! function_exists('set_empty_rules'))
{
function set_empty_rules($field_array)
{
if(isset($field_array) && is_array($field_array)):
$mythis =& get_instance(); // grabbing our ci this instance
foreach($field_array as $key => $val):
$mythis->form_validation->set_rules($key,$val,'');
endforeach;
endif;
}
}
And in your controller:
Code:
set_empty_rules(array('address'=>'Address','city'=>'City','state'=>'State','zip'=>'Zip'));
The function takes an array of key -> values where key = 'fieldname' and value='Field Error Message'