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.
Search for codeigniter validating dates:
You make it easy for them to compare what they entered to the error message.