Welcome Guest, Not a member yet? Register   Sign In
concat validation rules with form_validation
#7

Quote:I use jQuery Form validation, but that also only shows one error per field.

I don't think it would make sence to show all requirements when a field fails

I consider that it is important show all error that user have had when form is full, because it is boring to fill out a form several times.

For example, imagine that you fill your username and now show that is very long (max_length[10]). You correct it and now show that that user exists (custom rule to avoid repeat usernames). You correct again and now show that username haven't correct format (you put a number in username that you don't permit with rule alpha).
I know that it is a rare situation, but it may occur, and if application had shown all error from the beginning, user could have corrected all the errors or avoid them.

I have too a form multipart with option to upload a image file.
That image file must be .png or .jpg, with max. resolution 400x400 and other limitations that I set with Upload class.
However, when I have an error in a field and in the image file, it shows field errors only, not for image file. Then, if I correct all error for fields, when I submit form again, now it shows errors for image file.

I suppose that for this situation, it's similar that Form_validation, it shows errors one at time.
Although I have:

PHP Code:
if( $this->form_validation->run() && $this->upload->do_upload('filename') )
{
    
// Process information
}
else
{
    
$errores validation_errors();
    
$errores .= $this->upload->display_errors();
    echo 
$errores;


When there are errors in fields and in the image file, it shows errors for fields only.
Reply


Messages In This Thread
RE: concat validation rules with form_validation - by annx10 - 05-06-2017, 04:23 AM



Theme © iAndrew 2016 - Forum software by © MyBB