Forums

How to enforce skipping field (Required*) by entering blank spaces

hktanty 18 Aug, 2022
Hello,
I have a field Bench.name in a form. This field is marked Required and thus the end users are required to enter data. However, some users are just entering spaces to skip this field and the form is saving it.

In order to avoid this situation, I am doing the below PHP validation before Saving and converting to uppercase and trimming. After trimming, data entered only as blank spaces, becomes empty. However the empty data also gets saved, which is a nuisance.

$this->data("Bench.name", trim(strtoupper($this->data("Bench.name", ""))), true);

If any one can help me in guiding on how to resolve this issue, I will be very much thankful. FYI, I have declared this field as NOT NULL in database table level. But database is also not enforcing.
GreyHead 21 Aug, 2022
Hi hktanty,

If your PHP is validation code then have it return False if the entry is empty or just contains blanks.

Bob
You need to login to be able to post a reply.