I have three forms in a page. Say, one for login, one for register and one for forgot password. All these form actions and the same. During the submit, submitted form is identified by a hidden input value.
echo form_hidden('formname', 'registration');
echo form_hidden('formname', 'login');
echo form_hidden('formname', 'assistance');
Every form have set of validation rules such as valid_email
, min_length
etc. and errors are thrown if invalid submission. But the problem is, when errors are thrown it is shown all above the three forms. Because every form have validation_errors()
above it. And I cannot have single validation_errors
in my page.
So is there any way I can place the error messages corresponding to login form in a <div>
which ID is login-errors
and registration form's errors in <div>
which ID is registration-errors
etc.?
<div id='registration-errors'>
<?php
validation_errors(); // For error messages of registration form
echo form_open('account', array('method'=>"POST", 'autocomplete'=>"off", 'class'=>'user-register'));
// Hidden input + Other inputs and labels + Submit button
?>
</div>
<div id='login-errors'>
<?php
validation_errors(); // For error messages of registration form
echo form_open('account', array('method'=>"POST", 'autocomplete'=>"off", 'class'=>'user-login'));
// Hidden input + Other inputs and labels + Submit button
?>
</div>
<div id='assistance-errors'>
<?php
validation_errors(); // For error messages of forgot password form
echo form_open('account', array('method'=>"POST", 'autocomplete'=>"off", 'class'=>'user-assistance'));
// Hidden input + Other inputs and labels + Submit button
?>
</div>