dimanche 28 mars 2021

Laravel 5.5 form validation numeric/integer accepts non-digital characters like "+"

I want to validate the form data if it is just numeric/integer (as in just numbers). Based on Laravel's documentation there are two specific validators for that. But the problem I'm facing is that both the validators accept non-numeric characters such as "+" or "-".

numeric

The field under validation must have a numeric value.

integer

The field under validation must be numeric.

How can I make the validation to only accept numbers and not other non-numeric characters?

'main_telephone'    => 'numeric',
'main_fax'          => 'integer',
'direct_telephone'  => 'integer',
'mobile'            => 'integer',

Below is the screenshot

enter image description here



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire