Validation - prevent html |
Hi,
i want to prevent the user from input html in a contact form. The alpha_numeric_punct has no questionmark (?) or slash (/). Can we add this character by extending a rule or is there another way to prevent html? I know i can write a custom rule, but if there is a feature in ci i would use it.
Yes you can extend the Validation Class.
CodeIgniter 4 User Guide - Creating Custom Rules You could copy this method ( alpha_numeric_punct ) and work from that. What did you Try? What did you Get? What did you Expect?
Joined CodeIgniter Community 2009. ( Skype: insitfx )
(10-09-2022, 12:29 AM)InsiteFX Wrote: Yes you can extend the Validation Class. Thank you. Do i have to copy the method? I thought i could use the existing functionality and only add my extension. If the method will be updated later i don't have to copy the method again. I still have a second question: Do some rules depend on the language? I took the alpha Rule, but if i input a czech name like Tomáš the rule fails and i got an error message in my form. I think it is caused by the carachters áš
You can add your own, I just mentioned it so that you had something to go by.
What did you Try? What did you Get? What did you Expect?
Joined CodeIgniter Community 2009. ( Skype: insitfx )
|
Welcome Guest, Not a member yet? Register Sign In |