Forums

Whitespaces and validation

teokolo 21 Dec, 2010
Hello,
when I set some fields to "required", a user can bypass this restriction using a whitespace in the field. If I leave the field empty, I get an error. If I put a whitespace, the form is validated.

You can see an example here: http://www.bomboleelio.com/modulo-ordine-palloncini

Teo
GreyHead 21 Dec, 2010
Hi Teo,

Yes, the 'required' validation just tests that the input hs a value. A space is a completely valid value.

Bob
teokolo 21 Dec, 2010
Hi Bob,
thanks for your reply.

Do you know any workaround to fix this behaviour?

Teo
GreyHead 21 Dec, 2010
Hi Teo,

It depends what the acceptable values are? you could validate-alpha or validate-alphanum - but that may be too strict.

You could add a JavaScript snippet to remove any input entries that are just spaces . . . but then people like me put a '.' in the input instead.

Bob
This topic is locked and no more replies can be posted.