start and end date validation for searches [SOLVED] |
[eluser]bretticus[/eluser]
[quote author="tim1965" date="1257861727"] I am guessing i need some form of callback but am absoloutely stumped as to how to do this.[/quote] Stumped on how to call the callback or how to validate the dates? To call it, you just add it to your validation rules for the field you want to validate: Code: $this->form_validation->set_rules('date1', 'Ending Date', 'required|callback__datechecker'); Somewhere in your same controller class, build a _datecheck() method: Code: function _datechecker($date) //the argument is the value of the field specified in the rule above... For getting the date components you do something similar to extract the date parts and then use the checkdate function to validate: Code: list($month, $day, $year) = explode('/', $date1); [quote author="tim1965" date="1257861727"]I have a third field that is dependant on the start and end date parameters being set. I hide this and only display on input to start and end date using jquery, but once again want to make sure i have this covered in CI as well.[/quote] I think that is pretty much nothing more than sticking a "required" in your validation rule. See form validation in the manual. |
Messages In This Thread |
start and end date validation for searches [SOLVED] - by El Forum - 11-10-2009, 02:02 AM
start and end date validation for searches [SOLVED] - by El Forum - 11-10-2009, 02:43 AM
start and end date validation for searches [SOLVED] - by El Forum - 11-10-2009, 03:14 AM
start and end date validation for searches [SOLVED] - by El Forum - 11-10-2009, 03:20 AM
start and end date validation for searches [SOLVED] - by El Forum - 11-10-2009, 10:11 AM
start and end date validation for searches [SOLVED] - by El Forum - 11-11-2009, 07:52 AM
start and end date validation for searches [SOLVED] - by El Forum - 02-08-2010, 05:10 AM
|