javascript - 如何禁用文本字段中的粘贴

标签 javascript struts2 textfield

我有 2 个文本字段,第一个用于电子邮件,第二个用于确认电子邮件。用户不能在struts 2的confirm s:textfield中粘贴(ctrl+v或用鼠标)任何内容。

我创建的所有示例都只使用简单的html,我可以使用Struts 2的文本字段吗?

最佳答案

The problem of the other examples is that all was based on "onPaste" event in the html edit text, and the textfield of Struts2 doesn't have this event.

对于具有以下功能的 Struts UI 标签来说,这不是问题:

Dynamic Attributes Allowed: true

<s:textfield/> ,以及 <s:file/> , <s:textarea/>和其他人,有它,as you can read in the documentation (在参数下)。

这意味着您在标记中编写的所有内容(不是 Struts UI 标记属性)都将按原样在生成的 HTML 中报告,让您可以使用新功能,而无需强制 Apache 发布新版本的标记。

关于javascript - 如何禁用文本字段中的粘贴,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21255632/

相关文章:

jsp - 如何编辑<display :table>?显示的记录

java - 从jsp传递值到struts2 Action 的问题

swift - Swift 上的文本字段第一响应者到下一个响应者

javascript - 如何在MapboxGL Js中找到鼠标悬停下像素的rgb颜色?

javascript - 获取出现错误的函数名称

java - 在 Struts 2 中使用 jQuery 的 Ajax 表单提交按钮

android - TextField 中的文本问题 - Android Jetpack Compose

flutter - 将数据从自定义小部件文本字段传递到计算器 flutter

javascript - 变量提升示例

javascript - 在 lodash 中添加对象的新属性