- OutSystems.com
-
My Platform
- Community
Log in
Sign Up
![]() |
风流倜傥的香烟 · js如何实现抠图 | PingCode智库· 1 月前 · |
![]() |
瘦瘦的人字拖 · qtextbrowser,如何使用?添加一行 ...· 1 月前 · |
![]() |
威武的冰棍 · blog/posts/关于JavaScrip ...· 1 月前 · |
![]() |
叛逆的长颈鹿 · offset commit failed ...· 1 月前 · |
![]() |
坚强的骆驼 · 国家一二等水准测量规范gb/t12897-2 ...· 1 月前 · |
![]() |
爱吹牛的柑橘 · Steam 上的Galactic ...· 5 月前 · |
![]() |
力能扛鼎的抽屉 · 四方签订协议,通力共建广东海洋大学阳江校区! ...· 7 月前 · |
![]() |
睿智的钢笔 · 智学网查分查排名_zhixuewang ...· 11 月前 · |
![]() |
曾经爱过的八宝粥 · 2023年乒乓球亚锦赛:马龙男单折桂,陈梦/ ...· 1 年前 · |
![]() |
千杯不醉的电脑桌 · 突然的意外死亡和哺乳动物的潜水响应:复杂的紧 ...· 1 年前 · |
![]() |
风流倜傥的香烟 · js如何实现抠图 | PingCode智库 1 月前 |
Yes I want to use OnChange event to validate input field (for blocking special characters)
You can do so by adding a new screen action to handle the "On Change" event, and add to the flow something like this:
Seeing your other reply, you can modify the code to include the RegEx search:
How to implement regex flag like "g and i" to check the repeated characters?
Please elaborate on what exactly do you want to achieve. You just want to check if a specific character is duplicated within a string, while ignoring the case-sensitivity? Some examples would be great.
This is my javascript code. Now I want to remove special characters from the following text so my output will be "test123". I want to know that how we can pass flags like "gi" in the pattern?
let stringToReplace = "test#123#$%##@";
var desired = stringToReplace.replace(/[^\w\s]/gi, "")
console.log(desired) //test123
1. Add the "Regex_Replace" as a dependency from the Text extension:
2. Configure it as such:
Example:
Hi Navneet Garg,
Are you talking about the events present there on input widget or any other JavaScript event. Please elaborate your query.
Basically I am using text field OnChange event and in that action I am using a JavaScript to validate keyboard keys (like to block special keys #, $ etc.)
something like this
now out system giving me waring that event' is deprecated which is true as javascript will remove the event. So now how to pass event in the OnChange ?
https://developer.mozilla.org/en-US/docs/Web/API/Window/event
var regex = new RegExp("[a-zA-Z0-9]+$");var key = event.key;if (!regex.test(key)) { event.preventDefault();}
var event: Event
@deprecated
'event' is deprecated.(6385)lib.dom.d.ts(18286, 5): The declaration was marked as deprecated here.
No quick fixes available
One more problem is that event.key will not work on the mobile keyboard. So how we can validate input field on mobile as well ?
You can use this javascript to prevent special characters in input field:
document.getElementById($parameters.WidgetId).addEventListener("keypress", function(e){ var patternNotOk = eval("^a-zA-Z0123456789]/g");
var text = this.value.replace(patternNotOk, '');
if (this.value != text){ this.value = text; }});
Try to use this JS and let me know if still the issue persists.
Thanks & Regards.
Thanks for now I implemented similar kind of solution.