Codeigniter validating dates

It also prevents a user from having to re-enter every field to correct their error and complete your form.

To accomplish this in my own code, I copy the values from the $_POST array to another array.

By returning the values that the user originally entered you accomplish two tasks.

Now we will only have to create the callback function (actually a method inside our controller). As the manual states, we will create a function named just like the rule, without the “ All looks OK, but what if we want to have fast access to the errors so that we can change what the messages say? You could of course make custom messages for the rule, but that would get burdensome on the long run.

Let’s just start by moving all the messages inside an array that we will define in the constructor, and call those messages inside our method: …And still… Now, if we look at the ) if the result of the validation is false. So why not have an easier life by creating ourselves a file like that inside the application/language/english directory.

While it is common in web 2.0 applications to use client side code such as Javascript to validate form fields, this should not be relied on for a number of reasons.

Some users disable Javascript so you want to provide a working interface for these users.

Search for codeigniter validating dates:

codeigniter validating dates-16

You make it easy for them to compare what they entered to the error message.

Leave a Reply

Your email address will not be published. Required fields are marked *

One thought on “codeigniter validating dates”