当前位置:网站首页>EasyUI combobox determines whether the input item exists in the drop-down list
EasyUI combobox determines whether the input item exists in the drop-down list
2022-04-23 07:22:00 【qq_ fifteen million one hundred and ninety-seven thousand four 】
combobox Of getValue The method is strange , When the input item exists in the drop-down list , What is returned is what is needed ID, But when the input item does not exist in the drop-down list , But directly return the user's input results . This makes it impossible to determine whether the user has entered an item that does not exist in the drop-down box .
I thought of direct judgment for the first time getValue Get whether it is an integer string , As a result, the user may just enter a number that does not exist in the drop-down list , Will stay BUG hidden danger .
Several methods found by Baidu are similar , Basically in combobox Of onHidePanel( The drop-down list hides Events ) Incident , Compare the user input value with the list to determine whether there is . But I feel this method is not easy to use .
Actually , Think about it carefully , Now that the user input is correct ,getValue Can return correctly ID, There must be a traversal process inside the plug-in , Why should we go through it again outside ? Directly modify the plug-in , Let him getValue In error input, it directly returns null , No, you can judge directly getValue Is it blank to confirm whether the user input exists in the drop-down list ?
Check easyui Source code (1.9.15) After the discovery , In this part , There is indeed a variable (_b63), First assign the user input string , Then go through all the drop-down lists , If it exists in the drop-down list, reassign the variable to ID Field .
Here, you only need to change the variable to null by default , In this way, under the wrong input of the user ,getValue You get a null value , Directly confirm whether the user has entered an option that does not exist in the drop-down list by judging the null value .
Of course , Feeling easyui This strange practice , Maybe it's because there's something to deal with . Maybe it's for compatibility. The drop-down list is not bound ID Field , Only text Can correctly obtain text Content ? Anyway, my drop-down lists are bound ID Field , Let's use it first ~
版权声明
本文为[qq_ fifteen million one hundred and ninety-seven thousand four ]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204230609264980.html
边栏推荐
- 1.1 pytorch and neural network
- 【點雲系列】SG-GAN: Adversarial Self-Attention GCN for Point Cloud Topological Parts Generation
- torch_geometric学习一,MessagePassing
- Solution to slow compilation speed of Xcode
- Cancel remote dependency and use local dependency
- Summary of image classification white box anti attack technology
- Google AdMob advertising learning
- C language, a number guessing game
- PyTorch 22. PyTorch常用代码段合集
- 【动态规划】三角形最小路径和
猜你喜欢
[2021 book recommendation] kubernetes in production best practices
PyMySQL连接数据库
给女朋友写个微信双开小工具
[2021 book recommendation] red hat rhcsa 8 cert Guide: ex200
face_recognition人脸检测
微信小程序 使用wxml2canvas插件生成图片部分问题记录
ThreadLocal, just look at me!
【点云系列】Learning Representations and Generative Models for 3D pointclouds
【点云系列】PnP-3D: A Plug-and-Play for 3D Point Clouds
Google AdMob advertising learning
随机推荐
常见的正则表达式
WinForm scroll bar beautification
PyTorch 10. 学习率
Easyui combobox 判断输入项是否存在于下拉列表中
PyTorch 模型剪枝实例教程三、多参数与全局剪枝
如何对多维矩阵进行标准化(基于numpy)
Minesweeping games
画 ArcFace 中的 margin 曲线
Gobang games
Computer shutdown program
面试总结之特征工程
【点云系列】Relationship-based Point Cloud Completion
第1章 NumPy基础
第8章 生成式深度学习
N states of prime number solution
Chapter 2 pytoch foundation 1
【点云系列】点云隐式表达相关论文概要
第2章 Pytorch基础2
Pytorch model pruning example tutorial III. multi parameter and global pruning
Five methods are used to obtain the parameters and calculation of torch network model