CodeIgniter Forums
validation: alpha_dash but allow spaces? - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forum-23.html)
+--- Thread: validation: alpha_dash but allow spaces? (/thread-11240.html)



validation: alpha_dash but allow spaces? - El Forum - 09-01-2008

[eluser]Boyz26[/eluser]
Hi everyone,

I was trying to make a 'Display Name' input form and then validate it to make sure it only can be alpha_dash. But is there any way I can allow spaces in the form? Is there a way to add in exceptions?

Thank you!


validation: alpha_dash but allow spaces? - El Forum - 09-01-2008

[eluser]xwero[/eluser]
add a function to application/libraries/MY_Validation.php file with your own regex to allow spaces.


validation: alpha_dash but allow spaces? - El Forum - 09-01-2008

[eluser]mdavis1982[/eluser]
Or just add a callback validation method in your controller with a regex to allow spaces.


validation: alpha_dash but allow spaces? - El Forum - 09-01-2008

[eluser]Boyz26[/eluser]
Alright! Thank you so much!