FORUMS


The Form Tools forums are no longer active, but the old posts have been archived here. Please see the Help page on how to get help / report issues.

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Commas in error message (PHP Validation) [How-To]
#1
Lightbulb 
Quote:Note: your error message cannot contain commas. This is currently a limitation of the script.

I don't like this limitation, because my language requires comma after "Please" Big Grin

I want to suggest a little fix in file \global\code\validation.php

If replace:
PHP Code:
function validate_fields($fields$rules)
{
  
$errors = array();

  
// loop through rules
  
for ($i=0$i<count($rules); $i++)
  {
    
// split row into component parts
    
$row split(","$rules[$i]); 

at:
PHP Code:
function validate_fields($fields$rules$splitter ",")
{
  
$errors = array();

  
// loop through rules
  
for ($i=0$i<count($rules); $i++)
  {
    
// split row into component parts
    
$row split($splitter$rules[$i]); 

nobody be affected, but everyone obtain possibility to use any character for separating components of $rules[] (I prefer the semicolon):
PHP Code:
$rules[] = "valid_email;email;Oh, no, you really think that it looks like the email?";
$errors validate_fields($_POST$rules";"); 
Wink
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)