In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
This article will explain in detail how to set the required items in the custom form in the dream weaving dedecms. The editor thinks it is very practical, so I share it with you for reference. I hope you can get something after reading this article.
How to set the required items of custom form in Weaving Dream dedecms?
First of all, we've tried to make sure it works:
1. The editor opens\ plus\ diy.php
two。 Find this line of code at about 40 lines:
$dede_fields = empty ($dede_fields)?': trim ($dede_fields)
3. Under this line of code, add the code and delete the blank lines if copied.
The code is as follows:
/ / add required fields to judge if ($required fields) {if (preg_match (', /', $required)) {$requireds = explode (',', $required); foreach ($requireds as $field) {if ($$field=='') {showMsg ('with * is required, please fill in','- 1 'correctly); exit () } else {if ($required=='') {showMsg ('with * is required, please fill in','- 1') correctly; exit ();} / / end
4. After saving, find this line of code on the form page:
The code is as follows:
Under this line of code, add the code:
The copy code is as follows:
Note that this line of code needs to be modified according to the required items for your form, such as "name" and "mailbox".
Add a new field-"form prompt text": name-"field name": name
Add a new field-"form prompt text": mailbox-"Field name": email
This line of code should be:
The code is as follows:
In this way, these two options are set to be required. If you do not fill in them, you will open a window saying, "those with a * sign are required, please fill in them correctly." of course, this sentence can be changed to other words.
See another method on the Internet, untested, only as a collection of data.
Js method:
1. First add to the template where you want to publish the form
The code is as follows:
two。 Create a new file js.js in your custom path, then copy the following, paste and save, code:
The code is as follows:
Note:
The code is as follows:
$('# complain') .submit (function () / complain is the ID of the custom form. If the generated form is not available, you can add it yourself, that is, id= "complain" .if ($('# name'). Val () = ") {$('# name'). Focus (); / / # name is to verify the ID in the form. If you want the user name not to be empty, set the data field of the user name in the background to name, the same below.
3. After it is set up, you can update it and see the effect.
On the dream weaving dedecms custom form how to set the required items to share here, I hope the above content can be of some help to you, you can learn more knowledge. If you think the article is good, you can share it for more people to see.
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.