We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

[SOLVED] How to sanitize user input before validation ?

I want to sanitize phone number input by user before I validate it.

Normally user will enter phone number like "019000000". But sometime , they will enter "6019000000". No 6 is country code for Malaysia.

I want to remove No 6 , before I validate it. I want to check to make sure that , the phone number is not in database. But , if not remove No 6 , it will provide different result. My code https://pastebin.com/sNm7cdY8

Thanks.

Update

I have solved this problem. Just need to check user input , before pass the data to $form->isValid();



98.9k
Accepted
answer

How to mark discussion as solved ?