将事件处理程序添加到文本框apostrophecms
我是撇号世界的新手,我正在尝试将事件添加到文本框中,例如,当他们键入一个国家名称时,我想检查数据库以查看这个国家是否已经存在,我会使用此过程。我创建的一个小部件是为每个位置添加国家和特定办公室,因此我想在用户类型键入信息时拥有更多控制信息,例如让电话字段仅接受数字而不是字母等。 我希望我让自己清晰大声笑 非常感谢您的帮助
I'm new at the apostrophe world, I'm trying to add a event to a textbox, for example, when they type a country name I would like to check the database to see if this country already exists, I do this process with a widget that I create to add countries and specific offices for each location, so I would like to have more control when user's type type the information, like for example make phone fields accept only numbers instead of letters, etc.
I hope I made myself clear lol
Thank you so much for the help
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我是Apostrophecms团队的一员。
Apostrophecms当前不支持其标准字符串和TextArea字段的自定义前端和后端验证。但是,它确实支持自定义模式字段类型。这是一条有据可查的途径,可以完全使用您想要的行为来创建自己的字段类型。所以我建议这种方法。我链接到此处的文档提供了一个完整的示例。
I'm part of the ApostropheCMS team.
ApostropheCMS does not currently support custom front-end and back-end validation of its standard string and textarea fields. However it does support custom schema field types. This is a well-documented path to creating your own field types with exactly the behavior you want. So I would recommend that approach. The documentation I've linked to here provides a complete example.
我确实设法创建了一个新字段,我叫Isunique:
当我尝试调用异步时,我无法设法创建一个回调,例如,此字段已经存在。
I did manage to create a new field, I called isUnique:
When I trying to call the async I can't manage to create a callback, for example This field Already exists.