How to validate registration form?

I'm trying to validate registration form, for example I want to force users to use just English characters in 'username' field! 
I searched a lot! But I didn't find anything on form validation!
any help will be appreciated. 

  • Two suggestions:

    You could register into the 'register', 'user' plugin hook (see Elgg core action vendor/elgg/elgg/actions/register.php) to do your validation of registration fields.

    Or you can take a look into the code of the Profile Manager plugin. This plugin adds register form validation during input. It overrides the register form of Elgg core and comes with it's own register action and the JS code for live validation. You could take this functionality of the Profile Manager plugin to create a custom plugin that only does account registration validation exactly as you want it.

  • You can try and see how it is done in this plugin.