- Posts: 17
- Thank you received: 3
Regex
- John
- Topic Author
- Offline
- New Member
-
Less
More
8 years 3 months ago #93105
by John
Regex was created by John
Where can we add regex for the signup form? Specifically the username field and custom text fields?
Please Log in or Create an account to join the conversation.
- Tuan Pham Ngoc
- Offline
- Administrator
-
8 years 3 months ago #93115
by Tuan Pham Ngoc
Replied by Tuan Pham Ngoc on topic Regex
Hello John
1. To validate username, you would have to modify php code. Look at components/com_osmembership/controller/validator.php, look at method validate_username and customize it to meet your need
2. For custom fields, we use jquery validation engine, so you can use that library build in validation rule posabsolute.github.io/jQuery-Validation-Engine/ for validation custom field. Just enter the validation rules you want into Validation Rules settings of the custom field to validate it's data in the way you want.
Regards,
Tuan
1. To validate username, you would have to modify php code. Look at components/com_osmembership/controller/validator.php, look at method validate_username and customize it to meet your need
2. For custom fields, we use jquery validation engine, so you can use that library build in validation rule posabsolute.github.io/jQuery-Validation-Engine/ for validation custom field. Just enter the validation rules you want into Validation Rules settings of the custom field to validate it's data in the way you want.
Regards,
Tuan
Please Log in or Create an account to join the conversation.
- John
- Topic Author
- Offline
- New Member
-
Less
More
- Posts: 17
- Thank you received: 3
8 years 3 months ago #93213
by John
Replied by John on topic Regex
I've submitted a ticket, need some additional help on this - thanks
Please Log in or Create an account to join the conversation.
- Tuan Pham Ngoc
- Offline
- Administrator
-
8 years 3 months ago #93220
by Tuan Pham Ngoc
Replied by Tuan Pham Ngoc on topic Regex
I replied you via support ticket. I upload the modified file here in case someone has same question (of course, you would need to adjust the regext in the method validate_username in this file to meet your own need)
Regards,
Tuan
Regards,
Tuan
Attachments:
The following user(s) said Thank You: John
Please Log in or Create an account to join the conversation.
- Roland
- Offline
- New Member
-
Less
More
- Posts: 4
- Thank you received: 0
8 years 2 weeks ago #97136
by Roland
Replied by Roland on topic Regex
Hi Tuan, I would like to validate the username for Events Booking. Could you please give me a hint how to achieve this. Thanks, Roland
Please Log in or Create an account to join the conversation.
- Tuan Pham Ngoc
- Offline
- Administrator
-
8 years 2 weeks ago #97153
by Tuan Pham Ngoc
Replied by Tuan Pham Ngoc on topic Regex
Hello Roland
You would need to customize the code, too, in the same way. Look at the file components/com_eventbooking/controller/controller.php, method validate_username and customize it to meet your need
Regards,
Tuan
You would need to customize the code, too, in the same way. Look at the file components/com_eventbooking/controller/controller.php, method validate_username and customize it to meet your need
Regards,
Tuan
Please Log in or Create an account to join the conversation.
- Roland
- Offline
- New Member
-
Less
More
- Posts: 4
- Thank you received: 0
8 years 2 weeks ago #97237
by Roland
Replied by Roland on topic Regex
Hello Tuan,
Thank you very much for your fast reply.
I tried to apply your tweaked validate_username function, but it seems to have no effect.
I changed the Regex to
in order to allow only lower case letters for a username.
However, when I now submit the signup form with characters that don't match the regex, a user account is still created in Joomla. There is also no warning message that says something like "the username is not valid".
Is there anything else I need change in the code?
Roland
Thank you very much for your fast reply.
I tried to apply your tweaked validate_username function, but it seems to have no effect.
I changed the Regex to
Code:
/^[a-z]$/
However, when I now submit the signup form with characters that don't match the regex, a user account is still created in Joomla. There is also no warning message that says something like "the username is not valid".
Is there anything else I need change in the code?
Roland
Please Log in or Create an account to join the conversation.
- Tuan Pham Ngoc
- Offline
- Administrator
-
8 years 2 weeks ago #97245
by Tuan Pham Ngoc
Replied by Tuan Pham Ngoc on topic Regex
I am now confusing. Are you talking about Event Booking or Membership Pro? sign up form is a term which seems meet Membership Pro better
Maybe send me the link to registration form so that I can take a look at it/?
Tuan
Maybe send me the link to registration form so that I can take a look at it/?
Tuan
Please Log in or Create an account to join the conversation.
Support
Documentation
Information
Copyright © 2025 Joomla Extensions by Joomdonation. All Rights Reserved.
joomdonation.com is not affiliated with or endorsed by the Joomla! Project or Open Source Matters.
The Joomla! name and logo is used under a limited license granted by Open Source Matters the trademark holder in the United States and other countries.
The Joomla! name and logo is used under a limited license granted by Open Source Matters the trademark holder in the United States and other countries.