Hi all,
Is there a way to stop new users from using usernames with spaces in them?
Thanks Bruce
Not allow spaces in username
Re: Not allow spaces in username
Hi Bruce,
You can use the following javascript code in your hooks/<tablename>-dv.js file
(replace the <tablename> with your actual tablename)
(don't forget to replace the <fieldname> with the corresponding fieldname)
Good luck and stay safe.
You can use the following javascript code in your hooks/<tablename>-dv.js file
(replace the <tablename> with your actual tablename)
Code: Select all
// Set input to reject space. File hooks/tablename-dv.js
$j('#<fieldname>').keyup(function () {
$j(this).val($j(this).val().replace(/\s/g, ''));
});
Good luck and stay safe.
Zala.
Appgini 24.10.1579, MacOS 14.3.1 Windows 11 on Parallels.
Appgini 24.10.1579, MacOS 14.3.1 Windows 11 on Parallels.
Re: Not allow spaces in username
Just realized that you were asking about username as if new user registration field... hmmm
Sorry for the misunderstanding.
Sorry for the misunderstanding.
Zala.
Appgini 24.10.1579, MacOS 14.3.1 Windows 11 on Parallels.
Appgini 24.10.1579, MacOS 14.3.1 Windows 11 on Parallels.
Re: Not allow spaces in username
I have tried the following and it works...
I add similar code into the membership_signup.php file. (I am not sure if it will get overwritten when you regenerate the application.)
It should be around line 181 where you can see this code
I put the following code above that line
Good luck and stay safe.
I add similar code into the membership_signup.php file. (I am not sure if it will get overwritten when you regenerate the application.)
It should be around line 181 where you can see this code
Code: Select all
$j('#username').on('keyup blur', checkUser);
Code: Select all
$j('#username').keyup(function () {
$j(this).val($j(this).val().replace(/\s/g, ''));
});
Zala.
Appgini 24.10.1579, MacOS 14.3.1 Windows 11 on Parallels.
Appgini 24.10.1579, MacOS 14.3.1 Windows 11 on Parallels.
Re: Not allow spaces in username
Hi Zala, Thanks for the help. It worked perfectly.
Re: Not allow spaces in username
No problem...just remember to add the code if it is overwritten when you regenerate the application.
Stay safe.
Stay safe.
Zala.
Appgini 24.10.1579, MacOS 14.3.1 Windows 11 on Parallels.
Appgini 24.10.1579, MacOS 14.3.1 Windows 11 on Parallels.