PHP-Trim input value on udpate

QuestionsPHP-Trim input value on udpate
Alberto asked 3 weeks ago

Hi Abu,

 

I’m trying to delete white spaces from the grid input box when the value is submitted.

Does the grid framework offers any way of doing this?

 

Kind regards and thank you,

Alberto.

2 Answers
Abu answered 2 weeks ago

You can try following code, replace $grid with the variable of your grid object.

$e["on_insert"] = array("trim_data", null, true);
$e["on_update"] = array("trim_data", null, true);
$grid->set_events($e);

function trim_data($data)
{
	foreach($data["params"] as $k=>$v)
	{
		$data["params"][$k] = trim($v);
	}
}
Abu answered 2 weeks ago

More details on docs page: https://www.gridphp.com/docs/grid-events/

Your Answer

20 + 7 =

Login with your Social Id:

OR, enter

Attach code here and paste link in question.
Attach screenshot here and paste link in question.



How useful was this discussion?

Click on a star to rate it!

Average rating 0 / 5. Vote count: 0

No votes so far! Be the first to rate it.

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?