1

我在我的 php 代码中使用gldate 选择器,这样每当文本字段更改时,日期就会被提交,然后在我的 php 文件中进行处理。

这是我的html代码:

   <html>
     <body>
      <form method="post" action="test.html" name="myfrm" id="frm">

        <input type="text"  id="mydate" /> 

      </form>
   </body>
 </html>

这是我的js代码:

  $(window).load(function()
       {
        $('#mydate').glDatePicker({

            showAlways: true

            });

    onClick: (function(el, cell, date, data) {

        $("#frm").submit();
      })
    });


 </script>

有任何想法吗?我在谷歌上搜索了这个但找不到解决方案。

4

2 回答 2

0
 $(window).load(function()
       {
        $('#mydate').glDatePicker({

            showAlways: true,
             onClick: (function(el, cell, date, data) {

        el.val(date);

        if(data != null) {
          $("#frm").submit();
       }
      });
      });
   });
于 2013-10-15T11:18:43.297 回答
0

Rituraj 的答案在他编写时可能是正确的,但它目前在最新版本中不起作用。这就是我所拥有的:

$(window).load(function(){
    $('#mydate').glDatePicker({
        cssName: 'flatwhite',
        hideOnClick: true,
        onClick: (function(el, cell, date, data) {
            if(el.val() != '') {
                $("#frm").submit();
            }
        })
    });
});

el参数与日期选择器附加到的输入字段相关,因此这基本上表明,如果单击日期时输入字段不为空,则触发提交。

于 2015-06-18T12:00:47.020 回答