小编80s*_*ker的帖子

jQuery文本框验证,同时使用键和模糊

我有一个文本框,需要同时进行击键和模糊事件验证。如果我输入“ X”,则两个事件都将触发,并且显然,您将基于以下代码看到两个警报。需要keyup事件,因为我可能会基于有效值触发一些操作,并且还需要保持模糊事件,以防按Tab键。目标是在此处显示一个警报。\ m / \ m /

$("#txtLength").on('keyup blur', function (e) {
    if ($(this).val().length > 0) {
        switch (true) {

            case !$.isNumeric($(this).val()):
                alert("Please enter a numeric value.");
                $(this).focus();
                break

            case ($(this).val() < 5) || ($(this).val() > 10):
                alert("Length must be a numeric value between 5 and 10.");
                $(this).focus();
                break;

            default:
        }
    }
});
Run Code Online (Sandbox Code Playgroud)

validation jquery

4
推荐指数
1
解决办法
2万
查看次数

MongoDB 驱动程序查询 * 过滤器定义生成器 * Nin $nin 不在过滤器中

有没有人使用过 C# .Net MongoDB Driver FilterDefinitionBuilder's not in filter?这是我放在一起的一个简单示例,但我似乎无法开始工作。假设我们必须保持集合原样。目标是仅检索不在指定 ArtistGenresDocument 列表中的 ArtistDetailsDocument。

该代码不会编译并声明“无法将 lambda 表达式转换为类型 'MongoDB.Driver.FieldDefinition ArtistDetailsDocument,ArtistGenresDocument',因为它不是委托类型”。

感谢帮助!\毫米/

public class ArtistDetailsDocument
{
    public ObjectId Id { get; set; }
    public String artist_ID { get; set; }
    public String artistName { get; set; }
}

public class ArtistGenresDocument
{
    public ObjectId Id { get; set; }
    public String artist_ID { get; set; }
    public String genre { get; set; }
}

IEnumerable<ArtistGenresDocument> list = await ArtistGenresCollection.Find(x => x.genre == "Pop" | …
Run Code Online (Sandbox Code Playgroud)

c# mongodb mongodb-query

3
推荐指数
1
解决办法
1万
查看次数

标签 统计

c# ×1

jquery ×1

mongodb ×1

mongodb-query ×1

validation ×1