- Posts: 327
- Thank you received: 5
SOLVED validation server side on core organization field signup
- OTWD
-
Topic Author
- Offline
- Platinum Member
-
Less
More
1 month 2 weeks ago #167996
by OTWD
Success consists of going from failure to failure without loss of enthusiasm.
validation server side on core organization field signup was created by OTWD
Using j4.4.5 MP 3.6.1 php8.1
I have followed this (have done this successfully on EB)
docs.joomdonation.com/membershippro/basi...eld-data-server-side
Trying to do a server side validation on the "organization" core field
I have setup components/com_osmembership/helper/validator.php
Added the following code for a regex on 5 numbers and 1 letter:
No validation occurs on the MP signup form.
I have tried adding "rule2" as a test as well to the Server Validation Rules Field but it allows any value through (see screen shot "organization" core filed has the label "School Roll"
I have followed this (have done this successfully on EB)
docs.joomdonation.com/membershippro/basi...eld-data-server-side
Trying to do a server side validation on the "organization" core field
I have setup components/com_osmembership/helper/validator.php
Added the following code for a regex on 5 numbers and 1 letter:
Code:
<?php
/**
* @package Joomla
* @subpackage Membership Pro
* @author Tuan Pham Ngoc
* @copyright Copyright (C) 2010 - 2018 Ossolution Team
* @license GNU/GPL, see LICENSE.php
*/
defined('_JEXEC') or die;
Valitron\Validator::addRule('schoolroll', function($field, $value, array $params, array $fields) {
// Validate for exactly 5 digits followed by a single letter
if (!preg_match('/^\d{5}[A-Za-z]$/', $value)) {
return false;
}
return true;
}, 'School Roll is 5 digits followed by 1 letter. WARNING! Accounts with incorrect School Rolls will be removed.');
Valitron\Validator::addRule('rule2', function($field, $value, array $params, array $fields) {
if ($value != 9)
{
return false;
}
return true;
}, 'The field must has value = 9');
No validation occurs on the MP signup form.
I have tried adding "rule2" as a test as well to the Server Validation Rules Field but it allows any value through (see screen shot "organization" core filed has the label "School Roll"
Success consists of going from failure to failure without loss of enthusiasm.
Please Log in or Create an account to join the conversation.
- OTWD
-
Topic Author
- Offline
- Platinum Member
-
Less
More
- Posts: 327
- Thank you received: 5
1 month 2 weeks ago #167997
by OTWD
Success consists of going from failure to failure without loss of enthusiasm.
Replied by OTWD on topic SOLVED validation server side on core organization field signup
Actually the validation kicks in after submission and it works perfectly.
Thanks
Thanks
Success consists of going from failure to failure without loss of enthusiasm.
Please Log in or Create an account to join the conversation.
- Tuan Pham Ngoc
- Offline
- Administrator
-
1 month 2 weeks ago #167999
by Tuan Pham Ngoc
Replied by Tuan Pham Ngoc on topic SOLVED validation server side on core organization field signup
Yes. The server validation is only processed when the form is submitted
Regards,
Tuan
Regards,
Tuan
Please Log in or Create an account to join the conversation.
Support
Documentation
Information
Copyright © 2024 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.