Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to add publish time function to dedecms Custom form

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

This article is about how dedecms custom forms add release time features. The editor thought it was very practical, so I shared it with you as a reference. Let's follow the editor and have a look.

How do I add the release time function to the dedecms custom form?

Dedecms custom form is very powerful, can do such as registration system, recruitment system, repair system and so on, the only disadvantage is that after the user submitted the form, the background does not show the submission time.

One way to do this online is:

The code is as follows:

But I tried and the result was not satisfactory. Every time I submitted the form, the time was the same. It shows that this method still doesn't work, and you can test it yourself.

So I share a way to implement the release time through JS from the starting point here, and the process is very simple:

1. Add a text field (not a time field) to the custom form, such as the field name "fill in time" and the field function name "shijian"

two。 In the time field of the form, add the JS code as follows:

The code is as follows:

_ window.onload = function () {var nowDate = new Date (); var str = nowDate.getFullYear () + "+ (nowDate.getMonth () + 1) +"-"+ nowDate.getDate () +" + nowDate.getHours () + ":" + nowDate.getMinutes () + ":" + nowDate.getSeconds (); document.getElementByIdx_x ("shijian"). Value=str;} / / phpfensi.com

Note: because this JS will automatically get the current time to fill in the computer, it is best to hide it with css control so that the filling time is not displayed, or change the property of type to hidden.

3. After submission, the filling time will be displayed in the background.

Thank you for reading! About dedecms custom form how to add release time function to share here, I hope the above content can be of some help to you, so that you can learn more knowledge. If you think the article is good, you can share it and let more people see it.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report