dsjlqkbpn029473708 2015-02-28 07:04
浏览 122

如何在fullcalendar jquery插件中获取allDay的值?

I'm using the fullcalendar jquery plugin and I want to get the value of allDay that is true or false and I want to append the value to a form.But value that is getting appended is [object Object]

<input type="hidden" id="apptAllDay" value="[object Object]">


<script type="text/javascript">
$(document).ready(function(){

    $('#calendar').fullCalendar({
        header: {
            left: 'prev,next today',
            center: 'title',
            right: 'month,agendaWeek,agendaDay'
        },
        defaultDate: '2015-02-12',
        selectable: true,
        selectHelper: true,
        select: function(start, end, allDay) {

            $('#apptStartTime').val(start);
            $('#apptEndTime').val(end);          
            $('#apptAllDay').val(allDay);


            $.magnificPopup.open({
                  items: {
                    src: '#popup',
                    type: 'inline'
                  }
            });


        },
        editable: true,
        eventLimit: true, // allow "more" link when too many events
        eventStartEditable : false,
        events: "http://localhost/app1/events",
    });



    $(document).on("click","#addEvent",function(e) {
        e.preventDefault();
        doSubmit();
    });


    function doSubmit(){

        var title = $("#titleContainer").val();
        var description = $.trim($("#descContainer").val());
        var url = $("#urlContainer").val();

        if (!title) {
            alert("Title is required");
            return false;
        }

        $("#calendar").fullCalendar('renderEvent',
            {
                title: title,
                start: new Date($('#apptStartTime').val()),
                end: new Date($('#apptEndTime').val()),
                allDay: ($('#apptAllDay').val() == "true")
            },
        true);

       }

});

How can I get the real value that is TRUE or FAlSE?

  • 写回答

1条回答 默认 最新

  • duankange2433 2015-03-02 10:58
    关注

    This might probably help you, change according to your requirement.

    function parseClientEvents(){
        var clientArr = $('#calendar').fullCalendar('clientEvents');
        for(i in clientArr){
             console.log(clientArr[i]);//gives events full description.
             console.log(clientArr[i].allDay);
            //check for value here and append to your hidden field.
           //all your logic goes here.         
        }
        return true;
    }

    </div>
    
    评论

报告相同问题?

悬赏问题

  • ¥15 求解O-S方程的特征值问题给出边界层布拉休斯平行流的中性曲线
  • ¥15 谁有desed数据集呀
  • ¥20 手写数字识别运行c仿真时,程序报错错误代码sim211-100
  • ¥15 关于#hadoop#的问题
  • ¥15 (标签-Python|关键词-socket)
  • ¥15 keil里为什么main.c定义的函数在it.c调用不了
  • ¥50 切换TabTip键盘的输入法
  • ¥15 可否在不同线程中调用封装数据库操作的类
  • ¥15 微带串馈天线阵列每个阵元宽度计算
  • ¥15 keil的map文件中Image component sizes各项意思