文本框不适用于日期输入 [英] Textbox is not working for date input

查看:52
本文介绍了文本框不适用于日期输入的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有这段代码可以正常工作,除了1件事是这样的:

I have this code that is working except 1 thing and that is the following:

当我在文本框中键入内容时,将显示一个日期选择器,单击日期时,该日期将显示在文本框中,例如"27-05-2014".现在,当使用下面的代码时,这应该使用正确的AJAX输出过滤页面.不幸的是,事实并非如此.任何帮助都非常宝贵.

When I type in the textbox a datepicker shows up, when the date is clicked the date is put in the textbox for example '27-05-2014'. Now this should filter the page with the right AJAX output when using code below. Unfortunately it doesnt. Any help is much apriciated.

JavaScript:

$('#boekingsnummer_1').keyup(function(){        
    updateEmployeesText($(this).val(),'boekingsnummer');        
});

$('#huiscode_1').keyup(function(){        
    updateEmployeesText($(this).val(),'huiscode');        
});

function updateEmployeesText(val,opt){        
    $.ajax({
    type: "POST",
    url: "submit.php",
    dataType : 'json',
    cache: false,
    data: {text: val, filterOpts:opt},
    success: function(records){
        $('#employees tbody').html(makeTable(records));
    }        
}); 
}

PHP:

$opts = (isset($_POST['filterOpts']) ? $_POST['filterOpts'] : FALSE);
$val = (isset($_POST['text']) ? $_POST['text'] : FALSE);

if (($val != FALSE) && ($opts == "boekingsnummer")){
  $where = " WHERE boekingsnummer LIKE '".$val."%'";
}elseif (($val != FALSE) && ($opts == "huiscode" )){
  $where = " WHERE huiscode LIKE '".$val."%'";
}

推荐答案

您未指定要使用的datepicker插件.

You didn't specified which datepicker plugin you using.

尽管您必须在datepicker的更新事件上而不是在keyup事件上进行ajax调用.

Though you have to make ajax call on the update event of datepicker rather on keyup event.

也许可以解决您的问题.

May be that can solve your problem.

这篇关于文本框不适用于日期输入的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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