Hi,
I maybe misunderstood you. The example below taken straight from the API Manual shows exactly how to have the add/edit work with an encrypted password.
public function users(){
$crud = new grocery_CRUD();
$crud->set_table('db_user');
$crud->set_subject('User');
$crud->required_fields('user_name');
$crud->columns('user_name','email','real_name','active', 'groups');
$crud->fields('user_name','email','password','real_name','active', 'groups');
$crud->field_type('password', 'password');
$crud->callback_before_insert(array($this,'encrypt_password_callback'));
$crud->callback_before_update(array($this,'encrypt_password_callback'));
$crud->callback_edit_field('password',array($this,'decrypt_password_callback'));
$output = $crud->render();
$this->_example_output($output);
}
function encrypt_password_callback($post_array, $primary_key = null)
{
$this->load->library('encrypt');
$key = 'super-secret-key';
$post_array['password'] = $this->encrypt->encode($post_array['password'], $key);
return $post_array;
}
function decrypt_password_callback($value)
{
$this->load->library('encrypt');
$key = 'super-secret-key';
$decrypted_password = $this->encrypt->decode($value, $key);
return "<input type='password' name='password' value='$decrypted_password' />";
}
If you want, you can include password in the list of required fields.