Welcome Guest, Not a member yet? Register   Sign In
date picker problem
#1

[eluser]boony[/eluser]
Hi,

I've just lost about 3 days of my sorry life trying to get a simple date picker to work in a form and have run out of time. I've tried to use js_calendar_pi but couldn't get it to actually select a date (I'm sure I followed the notes but no go) so I went looking at jquery and stuff but it all seems like a lot of bother to do what should be fairly simple. I've played around with so many different things that I'm completely lost (and my nose is now truly bent from slamming my head against the desk :grrr: ).

If anyone has a code snippet that shows how to do this in CI I would be forever grateful as I got to have a small prototype up and running in the next couple of days and would like to do something more useful with the few remaining brain cells I got left.... :down: pleeeeeeeese!!!
#2

[eluser]Dam1an[/eluser]
Hi
I don't have any code snippets for a date picker to give you, but I do have some advice...

Stuff like this isn't worth wasting 3 days, as it adds no new functionality, but just changes the way the user interacts with the aplication
All the date picker does, is puts the date into a text field, but lets a user pick it from a calendar instead of typing. You will still get the date in the same way when processing it, so just leave it as a textfield for now, and type in the date, and come back to it at the end when you have time.

The ammount of times I just enter ids of something into a textfield, and then go back to it later to create a drop down or something similar

Just my 2 cents
#3

[eluser]cahva[/eluser]
Jquery's datepicker is easy to use. I actually use the modified version (v2) which can be found here.

Check the demos in there and you'll see how easy it is to use.
#4

[eluser]boony[/eluser]
[quote author="Dam1an" date="1242580994"]Hi

Stuff like this isn't worth wasting 3 days, as it adds no new functionality, but just changes the way the user interacts with the aplication
[/quote]

Oh I agree Dam1am,

Trouble is that's what the damn brief wanted...a nice looking date picker. I think I'll just add some select fields for day & month instead and then let the app do the appropriate date calcs later. I know I can use jquery but blinking heck thats like taking a elephant gun to shoot a fly...ho hum :blank:
#5

[eluser]cahva[/eluser]
If he wants a datepicker, then do a datepicker Smile As I said its really not too hard to implement. Heres a example view (conroller calendar):

Code:
<html>
<head>
<title>Datepicker</title>
<$cript type="text/javascript" src="&lt;?php echo base_url() ?&gt;assets/js/jquery-1.3.2.min.js"></$cript>
<$cript type="text/javascript" src="&lt;?php echo base_url() ?&gt;assets/js/date.js"></$cript>
<$cript type="text/javascript" src="&lt;?php echo base_url() ?&gt;assets/js/jquery.datePicker-2.1.2.js"></$cript>

&lt;link rel="stylesheet" type="text/css" media="screen" href="&lt;?php echo base_url() ?&gt;assets/css/datePicker.css"&gt;
&lt;link rel="stylesheet" type="text/css" media="screen" href="&lt;?php echo base_url() ?&gt;assets/css/freestyler.css"&gt;
<$cript type="text/javascript">
$(function()
{
    $('.date-pick').datePicker();
});
</$cript>
&lt;/head&gt;
&lt;body&gt;
&lt;?php if ($this->input->post('date1')): ?&gt;
<p>Date sent: &lt;?php echo $this->input->post('date1') ?&gt;</p>
&lt;?php endif; ?&gt;

&lt;?php
$dateconfig = array(
    'name'        => 'date1',
    'id'          => 'date1',
    'class'       => 'date-pick'
);

echo form_open('calendar');
echo form_input($dateconfig);
echo form_submit('submit','Submit');
echo form_close();
?&gt;
&lt;/body&gt;
&lt;/html&gt;

change $cript to script.. The xss cleanup f*cks up javascript code.

See.. no biggie. Just download jquery, date, css and the little calendar icon and off you go Smile
#6

[eluser]boony[/eluser]
[quote author="cahva" date="1242615134"]If he wants a datepicker, then do a datepicker Smile As I said its really not too hard to implement. Heres a example view (conroller calendar):



See.. no biggie. Just download jquery, date, css and the little calendar icon and off you go Smile[/quote]

Thanks Cahva, I sort of got all this already. I guess with all the mucking about with the js_calendar_pi plugin the problem became bigger than it should have been. I started losing track of which piece of code (for which javascript app) was doing what and then I got stuck with some other stuff about creating a helper/plugin for using generic javascript and then....thats when I started my head banging Sick . Hehehee, in the cold late of day (well cold late of morning my time) I think I need to go back to square one and start afresh.

But as a general note, if anyone has implemented the js_calendar_pi to do the date picking then I would be interested to see where I was going wrong....

Thanks again for all your help
Boony
#7

[eluser]agubski[/eluser]
Here is pretty simple applet if you still searching ...

http://www.softcomplex.com/products/tigra_calendar/
#8

[eluser]qirk petrucci[/eluser]
how about CI calendar's class? is it worth it?
#9

[eluser]agubski[/eluser]
Never tried it. Will go check it out now...
#10

[eluser]Thorpe Obazee[/eluser]
It's not a calendar date picker.




Theme © iAndrew 2016 - Forum software by © MyBB