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:
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"