The following warnings occurred:
Warning [2] Undefined variable $unreadreports - Line: 26 - File: global.php(961) : eval()'d code PHP 8.1.2-1ubuntu2.18 (Linux)
File Line Function
/global.php(961) : eval()'d code 26 errorHandler->error
/global.php 961 eval
/showthread.php 28 require_once





× This forum is read only. As of July 23, 2019, the UserSpice forums have been closed. To receive support, please join our Discord by clicking here. Thank you!

  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Registration: non-required fields
#1
M.b. i'm wrong, but there is no check for required rule value, so every registration field is required.

take a look at join.php. Field 'company' isn't required, but without filling in your get an error "Company Name is required"

<pre>
Code:
    $validation->check($_POST,array(
      'username' => array(
        'display' => 'Username',
        'required' => true,
        'min' => 5,
        'max' => 35,
        'unique' => 'users',
      ),
      'fname' => array(
        'display' => 'First Name',
        'required' => true,
        'min' => 2,
        'max' => 35,
      ),
      'lname' => array(
        'display' => 'Last Name',
        'required' => true,
        'min' => 2,
        'max' => 35,
      ),
      'email' => array(
        'display' => 'Email',
        'required' => true,
        'valid_email' => true,
        'unique' => 'users',
      ),
      'company' => array(
        'display' => 'Company Name',
        'required' => false,
        'min' => 0,
        'max' => 75,
      ),
      'password' => array(
        'display' => 'Password',
        'required' => true,
        'min' => 6,
        'max' => 25,
      ),
      'confirm' => array(
        'display' => 'Confirm Password',
        'required' => true,
        'matches' => 'password',
      ),
    ));
</pre>





If we add some check in validate.php, registration run smooth without filling company field:
<pre>
Code:
                if ($rule === 'required' && empty($value)) {
                    $this->addError(["{$display} is required",$item]);
                } else if(!empty($value)){
</pre>




replace with
<pre>
Code:
                if ($rule === 'required' && $rule_value === true && empty($value)) {
                    $this->addError(["{$display} is required",$item]);
                } else if(!empty($value)){
</pre>
  Reply


Messages In This Thread
Registration: non-required fields - by spike - 07-19-2016, 12:28 PM
Registration: non-required fields - by mudmin - 07-24-2016, 06:21 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)