The following warnings occurred:
Warning [2] Undefined variable $unreadreports - Line: 26 - File: global.php(961) : eval()'d code PHP 8.2.28 (Linux)
File Line Function
/global.php(961) : eval()'d code 26 errorHandler->error
/global.php 961 eval
/printthread.php 16 require_once



UserSpice
Validate Class - Printable Version

+- UserSpice (https://userspice.com/forums)
+-- Forum: Support Center (https://userspice.com/forums/forumdisplay.php?fid=23)
+--- Forum: UserSpice 4.3 and Below (https://userspice.com/forums/forumdisplay.php?fid=26)
+--- Thread: Validate Class (/showthread.php?tid=635)



Validate Class - marceloatmartins - 07-10-2017

Hi everybody,

Do you have some documentation about "parameters' of Validate Class, because I have been one error like this:


Notice: Undefined index: display in C:\xamppadm\htdocs\appreq\users\classes\Validate.php on line 33 error.

In video about Validate I don't saw nothing about 'display' parameter.

Thanks



Validate Class - faguss - 07-14-2017

Here's an example:

Code:
$rules      = [
Code:
"name" => [
Code:
"display"       => "Username",
Code:
"required"      => true,
Code:
"unique_update" => "users,".$userId,
Code:
"min"           => 1,
Code:
"max"           => 25
Code:
]
Code:
];
Code:
$validation = new Validate();
Code:
$validation->check($_POST, $rules);
Code:
if ($validation->passed()) {};



Validate Class - karsen - 07-15-2017

The display parameter is what the form control is called in the error message.

Code:
Username already exists. Please choose another Username. // "display" => "Username"
Code:
Email already exists. Please choose another Email. // "display" => "Email"

For all the other parameters, you can look them up in users/classes/Validate.php and see the full list (we also have a post in the modifications subforum that has additional custom validations), but display is the only parameter that isn't an actual validation rule.


Validate Class - marceloatmartins - 07-17-2017

Thanks for your suggestions, it's work well.
'display' is a property of Class, cool.
I opened the Class and saw others importants details.
Hugs