Get the App
SLTechnology News&Howtos  ›  Servers  › 

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

Shulou Source: shulou.com Published: 2022-06-02 11:30:04 10月27日 Update

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.

Tags: Content title field file method menu that is prompt model cache compare analyze update select verify minimum professional two small and medium that is Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Tech Info Shulou Technology macOS Redmi Huawei