在另一个字段上的输入字段的更改值在Strapi中的模糊事件

发布于 2025-02-10 02:53:33 字数 341 浏览 3 评论 0原文

为此,我一直在为Strapi的文档挣扎。

有一系列文章。创建文章时,有2个字段,即开始日期和结束日期。现在,当启动日期的值更改和用户选择事件时,我想从此更新结束日期的值。

当然,价值的计算不是问题,但是我找不到任何东西来更新Blur事件的值。

现在,我正在使用 beforecreate update lifecycle钩子,但是当用户单击保存按钮时,strapi doc中提到的所有这些钩子都在运行。

这可能会解决情况,但对于来自WordPress或任何其他自定义CMS的用户而言,这不是一个想法的情况

I've been struggling with the docs of strapi for this.

There's a collection of articles. When creating an article, there are 2 fields i.e Start Date and End Date. Now when a value of Start Date changes and user is done selecting an event, I want to update the value of End Date 6 months from that.

Ofcourse the calculations of value are not a problem but I'm unable to find anything to update the value on blur event.

Right now, I'm using beforeCreate and beforeUpdate lifecycle hooks but all these hooks mentioned in strapi doc run when a user clicks Save button.

This might solve the case but this is not an idea scenario for a user coming from Wordpress or any other custom CMS where this is easily doable

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

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

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

放肆 2025-02-17 02:53:33

Strapi目前尚未提供任何模糊事件。我们已经在Strapi论坛上发布了评论,然后唯一的方法是使用Strapi提供的生命周期事件。请参阅此链接

  1. 单击“保存”按钮时合并这些值。

https://forum.strapi.io/t/change-value-of-input-field-field-on-nother-fields-blur-event-instrapi/19829

Strapi is not providing any blur events for now . We have Posted Comments on the strapi forum untill then only way to fix this is by using life cycle events provided by strapi. Refer this link https://docs.strapi.io/developer-docs/latest/development/backend-customization/models.html#lifecycle-hooks

  1. Get Date and Time in Separate Fields .
  2. Merge those values when clicking on save button .

https://forum.strapi.io/t/change-value-of-input-field-on-another-fields-blur-event-in-strapi/19829

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文