Validate Drop Down Selections - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: Validate Drop Down Selections (/showthread.php?tid=33598) Pages:
1
2
|
Validate Drop Down Selections - El Forum - 09-01-2010 [eluser]Petsoukos[/eluser] Hi, I want to validate a date formed with drop down selections. I have three different drop down menus. (Year, Month, Day) When it is submitted the controller receives three different POSTS. One for each drop down. I can make the validation very easy with PHP checkdate() function: Code: $y = $this->input->post('y'); Validate Drop Down Selections - El Forum - 09-01-2010 [eluser]iConTM[/eluser] I would make 1 field to input the date. If you want to use CI's formvalidation class you can do something like this: Code: $this->form_validation->set_rules('date', 'Date', 'callback_date_check'); Code: function date_check ($value) Validate Drop Down Selections - El Forum - 09-01-2010 [eluser]Petsoukos[/eluser] That's the thing. I don't want to use a text input field. I would like to have the drop downs... every one is using drop downs. Validate Drop Down Selections - El Forum - 09-01-2010 [eluser]iConTM[/eluser] The date check finetuned: Code: function date_check ($value) Validate Drop Down Selections - El Forum - 09-01-2010 [eluser]iConTM[/eluser] [quote author="Petsoukos" date="1283378428"]That's the thing. I don't want to use a text input field. I would like to have the drop downs... every one is using drop downs.[/quote] I don't agree about that I notice that the dropdowns are more and more replaced by textfields together with a datepicker. is more userfriendly (only one click) jquery datepicker: http://www.kelvinluck.com/assets/jquery/datePicker/v2/demo/ Validate Drop Down Selections - El Forum - 09-01-2010 [eluser]iConTM[/eluser] or: Code: // run the validation on 1 of the dropdowns Code: function date_check ($value) Validate Drop Down Selections - El Forum - 09-01-2010 [eluser]Petsoukos[/eluser] I tried the jQuery datepicker but for some odd reason when I click on the text field it just displays it in the main body of the page and not as a "pop-out" frame. Can't figure out how to make it work. Validate Drop Down Selections - El Forum - 09-01-2010 [eluser]iConTM[/eluser] You have to include the css: http://www.kelvinluck.com/assets/jquery/datePicker/v2/demo/styles/datePicker.css Validate Drop Down Selections - El Forum - 09-01-2010 [eluser]Petsoukos[/eluser] I didn't forget... Code: <link rel="stylesheet" href="<?php echo base_url();?>application/views/templates/default/css/datePicker.css" type="text/css" media="screen" charset="utf-8" /> This is the code from my header. Maybe the CSS file has to be on a different location... Validate Drop Down Selections - El Forum - 09-01-2010 [eluser]iConTM[/eluser] Does the link to your css file work? Try view source and copy paste the css link in your browser. |