全日历添加事件不是通过推广 [英] Full Calendar Add event not via promot

查看:94
本文介绍了全日历添加事件不是通过推广的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道如何让用户填写表单,而不是当用户点击fullcalendar的黑色部分时弹出的启动框。



<这基本上是我迄今为止所做的。正如你所看到的,我已经将数据发送到了正在工作的PHP页面,但是我只是对提示框感到不满意,反而希望它成为一种很好的形式,以便他们能够添加注释。 / p>

  select:function(start,end,allDay){
var title = prompt('Event Title:');
if(title){
calendar.fullCalendar('renderEvent',
{
title:title,
start:start,
end:end,
allDay:allDay,
$ b $,b $ b true //使事件stick
);
year = new Date(start).getFullYear();
month = new Date(start).getMonth()+ 1;
月=((月份<10)?'0':'')+月;

day =((new Date(start).getDate()<10)?'0':'')+ new Date(start).getDate();

hours =((new Date(start).getHours()< 10)?'0':'')+ new Date(start).getHours();

min =((new Date(start).getMinutes()<10)?'0':'')+ new Date(start).getMinutes();

sec =((new Date(start).getSeconds()< 10)?'0':'')+ new Date(start).getSeconds();

start = year +' - '+ month +' - '+ day +''+ hours +':'+ min +':'+ sec;

year = new Date(end).getFullYear();
month = new Date(end).getMonth()+ 1;
月=((月份<10)?'0':'')+月;

day =((new Date(end).getDate()<10)?'0':'')+ new Date(end).getDate();

hours =((new Date(end).getHours()<10)?'0':'')+ new Date(end).getHours();

min =((new Date(end).getMinutes()<10)?'0':'')+ new Date(end).getMinutes();

sec =((new Date(end).getSeconds()< 10)?'0':'')+ new Date(end).getSeconds();

end = year +' - '+ month +' - '+ day +''+ hours +':'+ min +':'+ sec;
// alert(start +' - '+ end);
$ b $ .get(system / classes / core.php?task = calendar& q = addnew& userid =+ userid +& title =+ title +& start =+ start + & end =+ end +& allDay =+ allDay,函数(数据){
alert(title +'是为'+ start +''+ end创建的);
}) ;
}
calendar.fullCalendar('unselect');
},


解决方案

您需要先创建一个带有标题的表单以及您希望提交的其他所有内容。然后将其包装在一个隐藏的div中。像这样...(简单的例子)

 < div class =popupstyle =display:none; position:固定;顶部:25%;左侧:25%;背景颜色:白色;> 
< input classtitletype =textsize =26/>
< a href =#onclick =return falseclass =submitFrom> submit< / a>& emsp;
< a href =#onclick =return falseclass =exit>取消< / a>
< / div>

每次选择时都会显示.show()表示隐藏的div。填写表格并提交.click()表单提交它将发送信息并再次隐藏div。

 选择:function(start,end,allDay){
$(。popup)。show();
var start = Date.parse(start)/ 1000;
var end = Date.parse(end)/ 1000;
var allDay = allDay;
var wipit = //创建一个会话ID,例如随机数,可以稍后清除以防止双重输入

$(。submitForm)。click(function(){
var title = $(。title)。val();

if(title){
$ .post(/ * page name * /,{title :title,start:start,end:end,allDay:allDay},function(){
$(。title)。val()
title =;
wipit =;
start ='';
end ='';
allDay ='';
calendar.fullCalendar('unselect');
calendar .fullCalendar('refetchEvents');
});
} else {
//清除所有信息,取消选择事件并提醒需要输入标题
}
$(。popup)。hide();
});

$(。exit)。click(function(){
//清除所有信息,取消选择事件并...
$(。popup)。 hide();
});

$ / code>

再一次,这是非常简单的和一般的,必须修改ato规格以及对你喜欢的风格,但它应该工作。让我知道这是否有帮助


Am wondering how I can allow users to fill out a form instead of the promot box that seems to pop up, when a user clicks on a black part of the fullcalendar

this is basically what I have done so far. as you can see i have it sending the data to a PHP page that is working, but I am just not happy with the prompt box and instead would like it to be a nice form that they are able to add notes to as well.

select: function(start, end, allDay) {
                    var title = prompt('Event Title:');
                        if (title) {
                            calendar.fullCalendar('renderEvent',
                                {
                                    title: title,
                                    start: start,
                                    end: end,
                                    allDay: allDay,

                                },
                                true // make the event "stick"
                            );
                             year = new Date(start).getFullYear();
                             month = new Date(start).getMonth()+1;
                             month = ((month < 10) ? '0' : '') + month;

                             day = ((new Date(start).getDate() < 10) ? '0' : '') + new Date(start).getDate();

                             hours = ((new Date(start).getHours() < 10) ? '0' : '') + new Date(start).getHours();

                             min = ((new Date(start).getMinutes() < 10) ? '0' : '') + new Date(start).getMinutes();

                             sec = ((new Date(start).getSeconds() < 10) ? '0' : '') + new Date(start).getSeconds();

                            start = year + '-' + month + '-' + day +' '+hours+':'+min+':'+sec;

                            year = new Date(end).getFullYear();
                             month = new Date(end).getMonth()+1;
                             month = ((month < 10) ? '0' : '') + month;

                             day = ((new Date(end).getDate() < 10) ? '0' : '') + new Date(end).getDate();

                             hours = ((new Date(end).getHours() < 10) ? '0' : '') + new Date(end).getHours();

                             min = ((new Date(end).getMinutes() < 10) ? '0' : '') + new Date(end).getMinutes();

                             sec = ((new Date(end).getSeconds() < 10) ? '0' : '') + new Date(end).getSeconds();

                            end = year + '-' + month + '-' + day +' '+hours+':'+min+':'+sec;
                            //alert(start+' - '+end);

                            $.get("system/classes/core.php?task=calendar&q=addnew&userid="+userid+"&title="+title+"&start="+start+"&end="+end+"&allDay="+allDay, function(data) {
                                alert(title + ' was created for '+ start +' '+ end);
                            });
                        }
                            calendar.fullCalendar('unselect');
                },

解决方案

You need to first create a form with a title and everything else you would like to submit. Then wrap it in a hidden div. Like so...(simple example)

<div class="popup" style="display:none; position:fixed; top:25%; left:25%; background-color:white;">
  <input class"title" type="text" size="26" />
  <a href="#" onclick="return false" class="submitFrom">submit</a>&emsp;
  <a href="#" onclick="return false" class="exit">cancel</a>
</div>

Every time a selection is made it will .show() that hidden div. Fill out the form and upon submission .click() of that form submit it will send the information and hide the div again.

select: function(start, end, allDay){
  $(".popup").show();
  var start = Date.parse(start) / 1000;
  var end = Date.parse(end) / 1000;
  var allDay = allDay;
  var wipit = // create a session id such as a random number that can be cleared later to prevent double submissio

  $(".submitForm").click(function(){
  var title = $(".title").val();

  if(title){
    $.post("/*page name*/", {title: title, start:start, end:end, allDay:allDay}, function(){
      $(".title").val("")
      title = "";
      wipit = "";
      start = '';
      end = '';
      allDay = '';
      calendar.fullCalendar('unselect');
      calendar.fullCalendar('refetchEvents');
    });
  } else {
    // clear all information, unselect events, and alert that a title needs to be entered
  }
  $(".popup").hide();
  });

  $(".exit").click(function(){
    // clear all info, unselect events and...
    $(".popup").hide();
  });
}

Again, this is very simple adn general and would have to be modified ato your specs as well as styled to your likings, but it should work. Let me know if this helps

这篇关于全日历添加事件不是通过推广的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆