当前位置:网站首页>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
边栏推荐
猜你喜欢

ArcGIS license server administrator cannot start the workaround

【点云系列】FoldingNet:Point Cloud Auto encoder via Deep Grid Deformation

Binder mechanism principle
![[2021 book recommendation] red hat rhcsa 8 cert Guide: ex200](/img/5a/387baa0f59e5a8a502bb157184d968.png)
[2021 book recommendation] red hat rhcsa 8 cert Guide: ex200

【点云系列】 场景识别类导读

Chapter 1 numpy Foundation

WinForm scroll bar beautification

机器学习——PCA与LDA

PaddleOCR 图片文字提取

C# EF mysql更新datetime字段报错Modifying a column with the ‘Identity‘ pattern is not supported
随机推荐
ArcGIS License Server Administrator 无法启动解决方法
利用官方torch版GCN训练并测试cora数据集
【动态规划】最长递增子序列
Compression and acceleration technology of deep learning model (I): parameter pruning
N states of prime number solution
Machine learning III: classification prediction based on logistic regression
PyTorch 21. PyTorch中nn.Embedding模块
1.2 初试PyTorch神经网络
第1章 NumPy基础
如何对多维矩阵进行标准化(基于numpy)
Migrating your native/mobile application to Unified Plan/WebRTC 1.0 API
Chapter 2 pytoch foundation 1
Machine learning II: logistic regression classification based on Iris data set
What did you do during the internship
face_recognition人脸检测
【点云系列】Fully-Convolutional geometric features
【點雲系列】SG-GAN: Adversarial Self-Attention GCN for Point Cloud Topological Parts Generation
[point cloud series] pnp-3d: a plug and play for 3D point clouds
Chapter 4 pytoch data processing toolbox
[2021 book recommendation] Red Hat Certified Engineer (RHCE) Study Guide