I'm newbie with Grocery Crud and would like to turn in uppercase values inserted by user in several textboxes.
To do that, i tryed to use "before insert" callback . This works as expected only if it is applied to only ONE field.
However it won't work if i try to call several callbacks to get multiple fields changed :
$crud->callback_before_insert(array($this,'form_nom_uppercase'));
$crud->callback_before_update(array($this,'form_nom_uppercase'));
$crud->callback_before_insert(array($this,'form_ville_uppercase'));
$crud->callback_before_update(array($this,'form_ville_uppercase'));
$crud->callback_before_insert(array($this,'form_prenom_uppercase'));
$crud->callback_before_update(array($this,'form_prenom_uppercase'));
public function form_nom_uppercase($post_array)
{
$post_array['nom'] = strtoupper(trim($post_array['nom']));
return $post_array;
}
public function form_ville_uppercase($post_array)
{
$post_array['ville'] = strtoupper(trim($post_array['ville']));
return $post_array;
}
public function form_prenom_uppercase($post_array)
{
$post_array['prenom'] = strtoupper(trim($post_array['prenom']));
return $post_array;
}
Could someone show how get few fields changed with 'before insert' with a single callback ?
Your help will be much appreciated.