⚠ In case you've missed it, we have migrated to our new website, with a brand new forum. For more details about the migration you can read our blog post for website migration. This is an archived forum. ⚠

  •     

profile picture

How can insert data with text auto upper?



deib97

deib97
  • profile picture
  • Member

Posted 17 April 2013 - 10:45 AM

hello friend

If an input in form with a string, how an input can be automatically turned into a string of capital or capital letters?

is there any hint for this problem?

thanks..


mavershim

mavershim
  • profile picture
  • Member

Posted 18 April 2013 - 01:01 AM

hi,

 

you can try callback_before_insert to turn all fields to capital letters.

 

sample..

on your controller function add line..

 

$crud->callback_before_insert(array($this,capitalize));

 

then create a function to capitalize each field

function capitalize($postarray){
 
      foreach ($full_name as $key_name => $key_value) {
              $postarray[$key_name] = strtoupper($key_value);
     }
     return $postarray;
}

deib97

deib97
  • profile picture
  • Member

Posted 18 April 2013 - 05:57 AM

thanks mavershim

its work for me...