Welcome Guest, Not a member yet? Register   Sign In
Javascript calendar problem
#2

[eluser]Pascal Kriete[/eluser]
Hmm, what I would do here is use the convenience function that CI already gives you: insert_date . I believe it's commented out by default, and I would leave it that way and make my own by adding it to the bottom of the script such as this:
Code:
<?php echo js_calendar_script('my_form');  ?>

<script type="text/javascript" charset="utf-8">
<!--
    function insert_date(cal)
    {
        cal = eval(cal);

        var date = cal.date_str();
        var parts = date.split('-');
        
        var year = parts[0];
        var month = parts[1];
        var day = parts[2];
        
        // Ajax request using the method of your choice
        /* ajax.request('my/date/controller/'+year+'/'+month+'/'+day, function() {
            method: 'post',
            onComplete: function(transport) {
                $('event_info_div')[removed] = transport.responseText;
            }
        });
        */
    }
//-->
</script>

Now, anytime a day on the calendar is clicked, the ajax request is run.

The controller receives the year, month, and day as it's argument and checks the db for an available event. If such an event exists it returns a view with the event data. If it doesn't exist it returns a view with a form to create an event. And if you're really slick that form will also ajax submit and re-update the div as a live preview of the event you just created.

Good luck.


Messages In This Thread
Javascript calendar problem - by El Forum - 03-31-2008, 05:31 AM
Javascript calendar problem - by El Forum - 03-31-2008, 07:26 AM
Javascript calendar problem - by El Forum - 03-31-2008, 08:50 AM
Javascript calendar problem - by El Forum - 03-31-2008, 11:40 PM
Javascript calendar problem - by El Forum - 04-01-2008, 11:37 AM
Javascript calendar problem - by El Forum - 04-01-2008, 02:06 PM
Javascript calendar problem - by El Forum - 04-08-2008, 10:46 AM



Theme © iAndrew 2016 - Forum software by © MyBB