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

What are the ways to solve the problem that the phpcms title cannot be empty?

2025-04-10 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

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

In this issue, the editor will bring you some ways to solve the problem that the title of phpcms can not be empty. The article is rich in content and analyzes and narrates it from a professional point of view. I hope you can get something after reading this article.

The solution where the phpcms title cannot be empty: first open and modify the contents of the "global.func.php" file; then find and open the "form.inc.php" file; then add the statement "$linkageidb=$linkageid+1;"; and finally update the cache.

PHPCMS V9 adds a verification reminder function to the linkage menu field to solve the problem that the title cannot be empty.

In V9 system, if you add a linkage menu field to the model

Even if you set a minimum value of 1 in the field settings, there will be no prompts such as "title cannot be empty" if you do not select the value in the linkage menu before submitting the content.

Here are the solutions

Open the phpcms\ libs\ functions\ global.func.php file and find the

$var_input = $defaultvalue & & (route_a=='edit' | | route_a=='account_manage_info')?':''

Modified to:

$var_input = $defaultvalue & & (route_a=='edit' | | route_a=='account_manage_info' | | route_a=='info_publish')?':''

In fact, it means to add one more id= to the hidden form.

Compare it with yourself.

The second one is

Open:

Phpcms\ modules\ content\ fields\ linkage\ form.inc.php

Find the third line and add after it

$linkageidb=$linkageid+1; $errortips = $this- > fields [$field] ['errortips']; if ($errortips | | $minlength) $this- > formvalidator. =' $("# axi.field.'). Formvalidator ({onshow:", onfocus: ". $errortips.'"}). Inputvalidator ({min:'.$linkageidb.',max:9999,type: "value", onerror: ". $errortips.'"});'

The contents of the modified phpcms\ modules\ content\ fields\ linkage\ form.inc.php file are attached below, compared with your own modified file.

Function linkage ($field, $value, $fieldinfo) {$setting = string2array ($fieldinfo ['setting']); $linkageid = $setting [' linkageid']; $linkageidb=$linkageid+1; $errortips = $this- > fields [$field] ['errortips'] If ($errortips | | $minlength) $this- > formvalidator.). Formvalidator ({onshow: ", onfocus:". $errortips.' "}) .inputvalidator ({min:'.$linkageidb.',max:9999,type:" value ", onerror:". $errortips.' "});'; return menu_linkage ($linkageid,$field,$value);}

There are only two places to modify the file. The next step is to enter the background and click on the update cache in the upper right corner.

Then go to the model management to find the linkage menu field that needs to be prompted for verification, and fill in the item "failed data verification prompt" in the field settings, such as "Please select *"

These are the solutions that the editor shared for you to solve the problem that the phpcms title cannot be empty. If you happen to have similar doubts, you might as well refer to the above analysis to understand. If you want to know more about it, you are welcome to follow the industry information channel.

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