我有一个拖放日历,“拖放”需要将详细信息传递到变量中。
到目前为止,我已经设法让它附加到一个 textarea 中,这样我就可以看到它正在很好地记录数据或创建一个隐藏字段来进行最后一滴。
但是,我需要将每个项目都放在一个隐藏字段中,这样我就可以将它传递到下一页,然后在 PHP 中对其进行处理。
我猜我需要某种循环,所以对于每一滴......生成隐藏场。
但我没有运气让它工作。
这是我的代码。任何帮助都会非常有用。
谢谢
drop: function(date, allDay) { // this function is called when something is dropped
// retrieve the dropped element's stored Event Object
var originalEventObject = $(this).data('eventObject');
// we need to copy it, so that multiple events don't have a reference to the same object
var copiedEventObject = $.extend({}, originalEventObject);
// assign it the date that was reported
copiedEventObject.start = date;
copiedEventObject.allDay = allDay;
// render the event on the calendar
// the last `true` argument determines if the event "sticks" (http://arshaw.com/fullcalendar/docs/event_rendering/renderEvent/)
$('#calendar').fullCalendar('renderEvent', copiedEventObject, true);
//Record and add dropped items to list
var txt = $("#listbox");
var dtstart = copiedEventObject.start + '\n'
var caltitle = copiedEventObject.title
txt.val(txt.val() + dtstart); // For our reference - Remove later
var input = document.createElement("input");
input.setAttribute("type", "hidden");
input.setAttribute("name", "dtstart");
input.setAttribute("value", dtstart);
//append to form element that you want .
document.getElementById("calendarform").appendChild(input)
// remove the element from the "Draggable Events" list
$(this).remove();
}
});
});