Before update or before insert

Hi,
my question is probably quite simple.

i need to make a function with event before insert of before update that put data insered by users in capital letter .

something like this:

function bold_matricola($row)
{
$row->set_cell_style(“employee_id”,“font-weight:bold;”);
}

in this case set font style to bold.

Thank you for answer

Hi,

I did :

$grid->event->attach("beforeUpdate","my_update");

and the write this routine :

function my_update($data){
		// TO DO : Check on overlapping dates : forbidden !
        $var = $data->get_value("start"); // we have just a daynumber and a month, lets add a year
        $arr = explode("-",$var);
        $var = "2010-".$arr[1]."-".$arr[0];
		$date = date_create($var);
		if ($date) {
			$var = date_format($date, 'Y-m-d');            
        	$data->set_value("start", $var);
        }
        $var = $data->get_value("end"); // we have just a daynumber and a month, lets add a year
        $arr = explode("-",$var);
        $var = "2010-".$arr[1]."-".$arr[0];
		$date = date_create($var);
		if ($date) {
			$var = date_format($date, 'Y-m-d');            
        	$data->set_value("end", $var);
        }
    	$var = $data->get_value("price"); // format this for europe
    	$data->set_value('price', str_replace(',','.',(str_replace(' ', '',$var))));
    	$var = $data->get_value("price_2"); // format this for europe
    	$data->set_value('price_2', str_replace(',','.',(str_replace(' ', '',$var))));
} 

hope this helps.
steven

If you want to change data , before inserting in DB, you need to use something like above solution with beforeUpdate handler.

If you need to update data on the client side , after insert or update operation - it is a bit more complex but also possible.