CodeIgniter Forums

Full Version: validation: alpha_dash but allow spaces?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum

[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!

El Forum

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

El Forum

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

El Forum

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