0

Hi,

I just started learning CodeIgniter. There is a library $this->load->library('form_validation'); for form validation with rules. Does that mean we don't have to use Javascript to validate forms anymore? Because, if we have to use those validators in CI (sake of the best practise), what is the point of using Javascript... Or do I misunderstand the point here?

I know that not using JS puts extra work on server so we should use both JS and CI validation in any cases and also, JS might have been disabled as well. Am I right???

$this->form_validation->set_rules('textEmail', 'Email Address', 'trim|required|min_length[5]|max_length[100]|valid_email');

Thanks in advance

Edited by veledrom: .

2
Contributors
2
Replies
6
Views
6 Years
Discussion Span
Last Post by veledrom
0

You should always have server side validation regardless of whether or not you use client side validation. There are so many ways to send bad data to a web page you always want to make sure that it is clean before you process it or use it in any database activities.

Client side validation is really a convienence to the user. The client will always provide quicker feedback to the user, you can notify the user as soon as they exit the field of an invalid entry. Using only server side validation requires the user to wait for there input to be validated on the server.

The difficulty is keeping these vaidation checks in sync.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.