07-19-2016, 12:28 PM
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></pre>
If we add some check in validate.php, registration run smooth without filling company field:
<pre></pre>
replace with
<pre></pre>
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',
),
));
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)){
replace with
<pre>
Code:
if ($rule === 'required' && $rule_value === true && empty($value)) {
$this->addError(["{$display} is required",$item]);
} else if(!empty($value)){