如何使 Alfresco YUI 验证预填充的输入字段并避免“keyup”?

发布于 2024-12-26 17:50:06 字数 590 浏览 3 评论 0原文

我有一个 html 表单,其中有一些需要验证的输入字段:

<input type="text" id="hrs-edit-oib" name="oib">

我还有两个验证器。因此,使用新形式效果很好。但对于预先填充的表格,它不起作用。

我相信这是因为验证器设置为处理“keyup”事件:

createEmployeeForm.addValidation("hrs-edit-oib", Alfresco.forms.validation.mandatory, null, "keyup");

如果表单已在服务器端预填充,是否有办法告诉验证器立即处理表单?

这是一个例子: 我加载带有标记的页面:

"<input type="text" name="myid" value="preloaded" id="myid" />

假设“myid”的值需要长于两个字符(这里就是这种情况)。但是没有按键,并且我的“保存”按钮被禁用,直到我单击该字段并按 Tab 键或其他键。

谢谢

I have a html form with some input fields that need validation:

<input type="text" id="hrs-edit-oib" name="oib">

I also have two validators on it. So with the new forms it works great. But with the prepopulated forms, it doesn't work.

I believe it is because the validators are set to work on a "keyup" event:

createEmployeeForm.addValidation("hrs-edit-oib", Alfresco.forms.validation.mandatory, null, "keyup");

Is there a way to tell the validator to process the form rigth away, if it has been prepopulated on the server side?

Here's an example:
I load a page with markup:

"<input type="text" name="myid" value="preloaded" id="myid" />

And lets say that the value of "myid" needs to be longer then two chars (which is the case here). But there was no keyup and my Save button is disabled until I click into that field and press tab or something.

Thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文