Whitespace

QuestionsWhitespace
Gary Brett asked 9 years ago

Hi Abu, I have a column that our users paste a value into, this on occasions leaves a whitespace at the beginning of the value, is ther any method to trim the field on insert?

Example
normal
normal
3whitespace
1whitepsace
normal
normal

Thank you

1 Answers
Abu Ghufran answered 9 years ago

You can do it via PHP using on_insert / on_update events.

$e["on_insert"] = array("trim_input", null, true);
$e["on_update"] = array("trim_input", null, true);
function trim_input($data)
{
$data["params"]["fieldname"] = trim($data["params"]["fieldname"]);
}

Your Answer

20 + 17 =

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?