Method and system for managing form verification rules
By centrally writing and managing form verification rules, and using the mixins feature of the Vue framework to achieve reuse and unified management of rules, the inconvenient management of form verification rules in the existing technology is solved, and development efficiency and code maintainability are improved.
Patent Information
- Application Number
- CN202510136058.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-02-07
- Publication Date
- 2025-06-10
AI Technical Summary
The existing technology has defects in the centralized management, dynamic configuration and rule sharing of form verification rules, resulting in low development efficiency, high maintenance costs, and difficulty in achieving unified management and centralized update of rules.
By creating a file for form verification rules, centrally writing common form verification rules, and using the mixins feature of the Vue framework to introduce these rules into Vue components that need to apply verification rules, realizing the reuse and unified management of rules.
It realizes centralized management and unified definition of form verification rules, avoids repeated writing of verification logic, improves code reusability and maintainability, simplifies the process of update and maintenance of rules, and supports dynamic rule configuration and sharing and reuse across modules and applications.
Smart Images

Figure CN120122945A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of information system maintenance, and particularly relates to a method and a system for managing form verification rules. Background Art
[0002] With the rapid development of Internet applications, form validation has become an essential part of modern Web applications. Form validation is mainly used to ensure that the data entered by users conforms to the predetermined format and rules, and is a key step in ensuring the validity and integrity of data. In various Web applications, forms are widely used, from user registration, login to order filling, etc., and almost every interaction involves forms. Therefore, how to efficiently and flexibly implement form verification has become an important issue in front-end development. Especially in the process of using modern front-end frameworks such as Vue and React, the requirements for form verification are becoming increasingly complex. When facing an increasing number of verification rules, developers need a more concise, centralized and maintainable solution.
[0003] Currently, many front-end frameworks on the market, such as Vue and React, provide basic form validation functions. For example, the combination of the Vue framework and the ElementUI component library can achieve common form verification requirements, such as mandatory, numeric, email format verification, etc. However, with the gradual increase of project requirements, the form verification rules are not limited to basic format verification, but need to include more complex rules, such as numerical range, character combination, specific character arrangement, dynamic parameterization, etc. These complex verification rules usually involve different types of form elements and require flexible configuration and adjustment. To meet this diverse demand, developers usually encapsulate form verification rules into functions or methods, but this approach often leads to code duplication and difficult management. Especially in the face of a large project, the maintenance and update of verification rules become extremely cumbersome.
[0004] Most existing technical solutions adopt the method of hard - coding form validation rules into each form component, or extract common validation logic into independent functions for reuse. A significant problem with this approach is that the validation rules are often scattered across multiple components, making it difficult to achieve unified management and centralized update of the rules. When the form validation rules change, developers need to modify them in each component that uses the rule, increasing the risk of errors and maintenance costs. In addition, the repeated writing of validation rules also leads to code redundancy, reducing the maintainability and scalability of the code. Furthermore, when there are multiple form components in a project and they may share the same validation rules, existing technologies usually cannot effectively achieve rule reuse. Every time the rules are updated, developers may need to manually modify the code in multiple form components, greatly increasing the workload. If the update in some places is accidentally omitted, it may lead to inconsistent validation and even logical errors. Therefore, how to share and reuse validation rules among multiple forms and ensure the unity and consistency of these rules has become an urgent problem in current technologies. Another defect of existing technologies is the lack of support for dynamic rule configuration. Form validation in modern web applications is not just static. In many cases, it is necessary to dynamically adjust validation rules according to different business requirements or user inputs. For example, when filling out some forms, the validation rules for certain fields may change according to other options selected by the user. Some existing form validation methods do not provide flexible dynamic configuration functions, resulting in developers having to hard - code various conditional judgments in the code, increasing the complexity and the possibility of errors.
[0005] Therefore, there are certain defects in the existing technologies in terms of centralized management, dynamic configuration, and rule sharing of form validation rules. These problems not only affect development efficiency but also increase development and maintenance costs. Against this background, a new method and technical framework are needed that can centrally manage form validation rules, provide more efficient and flexible rule configuration capabilities, and support cross - module and cross - application sharing and reuse. Summary of the Invention
[0006] To solve the above - mentioned technical problems, the present invention proposes a technical solution for a method and system for managing form validation rules to solve the above - mentioned technical problems.
[0007] In the first aspect of the present invention, a method for managing form validation rules is disclosed. The method includes:
[0008] Step 1: Create a file for form validation rules, and centrally write common form validation rules in the form of functions in the created file for form validation rules. The validation rules are configured to support dynamic configuration of rule parameters.
[0009] Step 2: Use the mixins feature of the Vue framework to introduce the file of the form validation rules into the application file that needs to use the form validation rules. The application file that needs to use the form validation rules shares a unified validation rule.
[0010] Step 3: In the ElementUI validation function validator in the application file, directly call the validation rule function in the form validation rule file to implement form validation, and each validation rule function returns a preset error prompt message.
[0011] This technical solution proposes a method for managing form validation rules, which mainly includes three steps. The first step is to create a file for form validation rules, write the general form validation rules in the form of functions, and centralize them in this file. This file can contain validation rules for various form elements and support dynamic configuration of parameters. The second step is to use the mixins feature of the Vue framework to introduce the validation rule file into the Vue components that need to apply the validation rules to achieve rule reuse. The third step is to directly call the validation rule function in the rule file through the validation function (such as validator) provided by the ElementUI component library in the application file to perform form validation, and each validation rule function returns a preset error prompt message. The core of this technical solution lies in the centralized management of form validation rules, avoiding duplicate code scattered in multiple form components, and achieving the unity and consistency of rules. By using the mixins feature of the Vue framework, the rules are decoupled from the form components, improving the code reusability and simplifying the process of rule update and maintenance. At the same time, this technical solution is compatible with dynamic validation rules, such as validation rules that change in real time based on user input, further improving the flexibility of validation. At the same time, this technical solution can be extended to React, Angular, etc. to centrally manage and reuse the validation methods.
[0012] The beneficial effects of this technical solution are as follows: By centrally managing the form validation rules, developers can achieve unified rule definition and flexible reuse, avoiding the need to repeat the validation logic in each form component. Using the mixins feature of the Vue framework enables the validation rules to be shared and dynamically updated among different components, improving the code reusability and maintainability.
[0013] According to the method of the first aspect of the present invention, in the step 1, the form validation rules include validation rules for various form elements, including at least validation rules for numerical values, character combinations, and digital arrangements.
[0014] This technical solution further clarifies the content of the form verification rules. In particular, it mentions that the verification rules include the verification of various form elements, specifically including common verification types such as numerical values, character combinations, and digit arrangements. This indicates that the method not only supports common format verifications (such as email addresses, mobile phone numbers, etc.), but also includes various rules such as complex numerical range verifications and verifications of specific character combinations, and can handle more complex form verification requirements.
[0015] The beneficial effect of this technical solution is that the beneficial effect of this feature is that the method can handle different types of form elements, increasing the generality and scope of application of the verification rules. Developers can effectively verify various input types through a unified rules file, reducing the duplicate coding of different form verification rules and improving development efficiency.
[0016] According to the method of the first aspect of the present invention, the verification rule functions in the file of the form verification rules support the refinement of specific rules through parameterized configuration.
[0017] This technical solution emphasizes that the rule functions in the verification rules file support the refinement of rules through parameterized configuration, that is, allowing the adjustment of verification rules according to different requirements during the application process. This parameterized configuration enables the same rule to exhibit different behaviors in different scenarios. For example, for the same type of numerical verification, the numerical range can be dynamically adjusted according to different form fields. At the same time, this technical solution also includes the dynamic analysis of business logic. The dynamic analysis refers to the intelligent derivation and adjustment based on the changes in business data or user input. This technical solution can well adapt to the personalized needs of different form elements. For example, based on the business requirements of different fields, the verification rules are automatically adjusted.
[0018] The beneficial effect of this technical solution is that through parameterized configuration, developers can finely adjust the verification rules according to different business scenarios and form element requirements. This provides higher flexibility and adaptability for form verification, can handle changing requirements, and at the same time reduces the complexity of modifying the verification logic.
[0019] According to the method of the first aspect of the present invention, when the verification rules change, modify them in the file of the form verification rules, and automatically update them to all forms using these verification rules through the characteristics of the framework.
[0020] This technical solution describes that when the verification rules change, only the file of the form verification rules needs to be modified, and the framework will automatically update all forms using this verification rule. Through the automatic update feature of the framework, developers do not need to manually modify each form component, reducing the repetitive labor during rule updates. At the same time, this technical solution is further combined with version control and rollback mechanisms so that when the rule modification fails, it can quickly restore to the previous stable version. Combined with cloud computing and distributed applications, this method can also support synchronous updates of verification rules between multiple terminals or multiple systems.
[0021] The beneficial effect of this technical solution is that: the beneficial effect of this feature is that by centrally managing the verification rules, developers no longer need to manually update the rules in each form, avoiding possible errors or omissions during rule updates. The automatic update mechanism of the framework ensures the consistency of the rules, greatly reducing the maintenance cost.
[0022] The second aspect of the present invention discloses a system for managing form verification, the system includes:
[0023] A rule module, the rule module includes a form verification rule file, the form verification rule file contains general form verification rules written centrally, and the rules at least include verification rules for numerical values, character combinations, and digital arrangements;
[0024] An application module, the application module includes an application file, the application file is a file that introduces the form verification rules by using the mixins feature of the Vue framework, and the verification of the application file is based on the form verification rules;
[0025] In the application file, it includes an ElementUI verification function validator for calling the form verification rule function, and returns a preset error prompt message when the verification function fails.
[0026] This technical solution describes a system for form verification, including a rule module, an application module, and a calling mechanism for verification functions. The rule module is responsible for storing and managing form verification rules, and the application module introduces the rules and calls the verification functions therein. Each verification function will return a preset error prompt message when the verification fails. Through the modular design of this system, the rules and application logic are separated, further improving the scalability and maintainability of the system. The rule module centrally manages all form verification rules, enabling developers to update and maintain them conveniently, while the application module is responsible for interacting with the user interface. This technical solution is applicable to large-scale project development. At the same time, this technical solution has a priority management mechanism, and when there are conflicts among multiple verification mechanisms, they are processed according to the priority.
[0027] The beneficial effects of this technical solution are as follows: The design of this system enables the form verification rules to be centrally managed and uniformly defined, ensuring the consistency of the verification logic. By separating the rule module from the application module, the system has good scalability and maintainability, and at the same time can simplify the rule update and application in the development process. For the development team, such a system can improve productivity and reduce repetitive labor.
[0028] For the system according to the second aspect of the present invention, the form verification rules support dynamic parameter configuration.
[0029] This technical solution points out that the form verification rules in the system support dynamic parameter configuration. This means that in the form.
[0030] The beneficial effects of this technical solution are as follows: The external dynamic parameter configuration enables the system to flexibly adapt to changing requirements, such as dynamically adjusting the verification rules according to the data input by the user or the status of other form fields. In this way, developers can provide more detailed and accurate verification logic for different business scenarios, enhancing the flexibility and user experience of the system.
[0031] For the system according to the second aspect of the present invention, it includes a log recording module, and the log recording module is used to record the failed verification information when the form verification fails. The failure message at least includes the verification time, the reason for failure, and the corresponding form element.
[0032] This technical solution introduces a log recording module, which is used to record relevant information about failures when the form verification fails, such as the verification time, the reason for failure, and the corresponding form element. Such a recording mechanism can provide a basis for developers to troubleshoot faults and is also convenient for optimizing form verification. The log recording module provides a detailed tracking function for form verification failures, which is crucial for system optimization and debugging. Defects or inconsistencies that may exist in the verification rules can be discovered through the log, so as to make fine adjustments to the rules. In addition, the log recording module is integrated with the analysis platform or monitoring system to help developers more efficiently identify form verification problems encountered by users during use, further improving the user experience of the product.
[0033] The beneficial effects of this technical solution are as follows: The log recording module provides valuable debugging information for developers, helping to quickly locate the cause of form verification errors. By recording the failed verification information, the system can help developers identify common input errors and problems, and optimize and adjust the rules according to the log data, improving the stability and user experience of the system.
[0034] The system according to the second aspect of the present invention includes a rule dependency management module, which is used to manage the verification rule dependency relationships between different form elements, ensuring that when the verification rules of form elements change, other relevant form elements maintain the consistency and integrity of form verification.
[0035] This technical solution proposes a rule dependency management module for managing the verification rule dependency relationships between different form elements. It ensures that when the verification rule of a form element changes, the verification rules of other related form elements can be automatically synchronized and updated. The core value of the rule dependency management module lies in ensuring the consistency between form rules. In actual development, there are often dependency relationships between form elements. For example, the verification rules of some fields may be affected by the input values of other fields. By automatically maintaining these dependency relationships, this module can effectively avoid problems in the entire form verification caused by changes in a single form element.
[0036] The beneficial effect of this technical solution is that: the rule dependency management module avoids the overall verification failure caused by changes in the rules of a single field by ensuring the rule consistency between form elements. It can effectively maintain the integrity and consistency of form rules, reduce the workload of developers, and reduce potential problems caused by inconsistent verification.
[0037] The third aspect of the present invention discloses an electronic device. The electronic device includes a memory and a processor. The memory stores a computer program. When the processor executes the computer program, it implements the steps in a method for managing form verification rules according to any one of the first aspects of the present disclosure.
[0038] The fourth aspect of the present invention discloses a computer-readable storage medium. A computer program is stored on the computer-readable storage medium. When the computer program is executed by a processor, it implements the steps in a method for managing form verification rules according to any one of the first aspects of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS
[0039] In order to more clearly illustrate the specific embodiments of the present invention or the technical solutions in the prior art, the following will briefly introduce the drawings required for use in the description of the specific embodiments or the prior art. Obviously, the drawings in the following description are some embodiments of the present invention. For those of ordinary skill in the art, without creative efforts, other drawings can also be obtained based on these drawings.
[0040] Figure 1 It is a schematic diagram of a method for managing form verification rules according to an embodiment of the present invention;
[0041] Figure 2 It is a structural diagram of an electronic device according to an embodiment of the present invention. Detailed implementation manners
[0042] To make the objectives, technical solutions and advantages of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention. Apparently, the described embodiments are some but not all of the embodiments of the present invention. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of the present invention without creative efforts shall fall within the protection scope of the present invention.
[0043] The first aspect of the present invention discloses a method for managing form verification rules. Figure 1 As a schematic diagram of a method for managing form verification rules according to an embodiment of the present invention, as Figure 1 shown, the method includes:[[]]END]]
[0044] Step 1: Create a file for form verification rules, and centrally write general form verification rules in the form of functions in the file for creating form verification rules. The verification rules are configured to support dynamic configuration of rule parameters;
[0045] Step 2: Use the mixins feature of the Vue framework to introduce the file for form verification rules into the application file that needs to use form verification rules. The application file that needs to use form verification rules shares unified verification rules;
[0046] Step 3: In the ElementUI verification function validator in the application file, directly call the verification rule function in the form verification rule file to implement form verification, and each verification rule function returns a preset error prompt message.
[0047] In the said Step 1, the form verification rules include verification rules for various form elements, including at least verification rules for numerical values, character combinations, and digital arrangements.
[0048] The verification rule functions in the file for form verification rules support refinement of specific rules through parameterized configuration.
[0049] When the verification rules change, modify them in the file for form verification rules, and automatically update them to all forms using the verification rules through the features of the framework.
[0050] In a specific embodiment, this embodiment provides a method for managing form verification rules based on the Vue framework. The specific steps are as follows:
[0051] Create a form validation rule file, which is used to centrally store all form validation rules. This file includes various common form validation rules, such as validation rules for email format, password strength, phone numbers, etc. Each validation rule is written in the form of an independent function and can be flexibly configured according to the incoming parameters. All rules are centrally stored for easy unified management and maintenance later.
[0052] Introduce the validation rules in the Vue component. In the form component, developers use the mixins feature of the Vue framework to introduce the above-created rule file into the application. Through the mixins feature, multiple form components can share the same validation rule file, avoiding duplicate writing of validation logic in each form component.
[0053] Application of the validation rules when the form is submitted. When the user fills out the form and clicks the submit button, the system will automatically call the corresponding validation rules to verify the form content. For example, when the user fills in the email field, the system automatically verifies whether the email format meets the specifications; when filling in the password field, the system verifies whether the password meets the preset strength requirements. If a certain validation fails, the system will return a preset error message to remind the user to make modifications.
[0054] Dynamically update and maintain the validation rules. Update the validation rules by modifying the content in the rule file. The modified rules will be automatically applied to all form components without modifying each form one by one. In this way, developers can quickly and efficiently maintain and update the form validation rules, reducing the maintenance cost.
[0055] This embodiment improves the code reusability and maintainability by centrally managing the form validation rules. Developers can centrally manage the validation logic of all forms in the rule file and achieve the reuse of multiple form components through the mixins feature of the Vue framework. When the validation rules need to be modified, only the content in the rule file needs to be modified, and all form components will be automatically synchronized and updated, reducing the risk of errors and enhancing the flexibility and scalability of the system.
[0056] The second aspect of the present invention discloses a system for managing form validation, specifically including:
[0057] A rule module, where the rule module includes a form validation rule file, and the form validation rule file contains commonly used form validation rules written centrally. The rules at least include validation rules for numerical values, character combinations, and digital arrangements;
[0058] An application module, where the application module includes an application file, and the application file is a file that introduces the form validation rules using the mixins feature of the Vue framework. The validations of the application file are all based on the form validation rules;
[0059] In the application file, there is an ElementUI verification function validator for calling the form verification rule function, which returns a preset error prompt message when the verification function fails.
[0060] The form verification rules support dynamic parameter configuration.
[0061] It includes a log recording module, which is used to record the failed verification information when the form verification fails. The failure message at least includes the verification time, the reason for failure, and the corresponding form elements.
[0062] It includes a rule dependency management module, which is used to manage the verification rule dependency relationships between different form elements to ensure the consistency and integrity of form verification when the verification rules of form elements change.
[0063] Among them, the rule dependency module is responsible for managing the verification rule dependency relationships between form elements. For example, the verification rules of some form fields may depend on the values of other fields, and the rule dependency management module will ensure the correctness of these dependency relationships. For example, the verification rule of a certain field may depend on the selection of another field, and the system will automatically adjust the rule to ensure the consistency of verification. When developers define form verification rules, they need to specify the dependency relationships between fields. The system will automatically adjust the verification rules of related fields according to these dependency relationships to ensure the integrity of form verification logic.
[0064] The operating principle of the rule dependency module includes the following steps:
[0065] First, define the dependency relationships. In the rule module, the verification rules of each form field can define dependency relationships. For example, the verification rule of a certain field may depend on the values of other fields. When the value of a field changes, the rules of other fields may also need to be updated.
[0066] When the user fills in the form and triggers the verification of a certain field, the rule dependency management module will check whether the verification rule of this field depends on other fields. If the verification rule of this field changes, the dependency management module will automatically trigger the update of the rules of related fields to maintain the correctness of the rules.
[0067] Through the rule dependency management module, developers can establish a dynamic rule update mechanism between different form fields. When the input or selection of a certain field changes, the system will dynamically update the verification rules of other related fields. This means that the system can respond to the user's input in real time, adjust and optimize the form verification logic.
[0068] The module can support dependency management at multiple levels. For example, the validation rule of field A depends on field B, and the validation rule of field B depends on field C. In this case, when the input of field C changes, the system will not only update the validation rule of field B, but also update the validation rule of field A to ensure the integrity of the validation rule chain for the entire form.
[0069] In a specific embodiment:
[0070] A user registration form contains the following fields: "Country", "Area Code", and "Phone Number". The user first selects a country, and the system automatically adjusts the format of the area code and the validation rule of the phone number according to the selected country.
[0071] Country field: When the user selects a country, the system sets different validation rules according to different countries. For the United States, the area code must be "+1", and for China, the area code is "+86".
[0072] Area code field: The rule of the area code field is dynamically updated according to the selection of the country field. For example, when the user selects China, the area code field should automatically require the input of "+86" as a prefix.
[0073] Phone number field: The validation rule of the phone number field is determined by the selected country in terms of length and format. For example, after selecting China, the phone number should be 11 digits, while after selecting the United States, the phone number should be 10 digits.
[0074] Operation steps:
[0075] Define dependencies:
[0076] In the rule module, the developer first defines the dependencies for the "Country" field, the area code field, and the phone number field. It can be clearly specified through a configuration file or a rule editor that the validation rule of the "Area Code" depends on the selection of the "Country" field, and the validation rule of the "Phone Number" depends on the "Area Code".
[0077] Country field dependency: Selecting different countries affects the rules of the area code and the phone number.
[0078] Area code field dependency: The content of the area code field must be consistent with the selected country.
[0079] Phone number field dependency: The length and format of the phone number depend on the selected country and the area code.
[0080] Trigger rule update:
[0081] When the user selects the country field (for example, selects "China"), the rule dependency management module will automatically trigger the rule updates for the area code field and the phone number field. For example, after selecting "China", the rule for the area code field is updated to require the input of "+86", and the rule for the phone number field is updated to require the input of 11 digits.
[0082] Dynamic update of validation rules:
[0083] When the user changes the country field in the form, the system will automatically trigger the validation mechanism of the rule dependency management module. At this time, the system will re-validate the area code field and the phone number field to ensure that they comply with the latest rules. If the country is changed from "China" to "USA", the rule for the area code field will be updated to "+1", and the length rule for the phone number field will be updated to 10 digits.
[0084] Validation during form submission:
[0085] When the user clicks the submit button after filling out the form, all fields related to dependencies will be automatically validated. The system will ensure that the validation rules for the area code and the phone number are completely consistent according to the selection of the country field and will perform the validation according to the dynamically changing rules.
[0086] Example illustration:
[0087] Initial state (selecting China):
[0088] Country field: China
[0089] Area code field: Must start with "+86".
[0090] Phone number field: Must be 11 digits.
[0091] After the user selects "USA":
[0092] Country field: USA
[0093] Area code field: Must start with "+1".
[0094] Phone number field: Must be 10 digits.
[0095] In this process, the role of the rule dependency management module is to dynamically respond to the user's selection changes of the "country" field and automatically adjust the validation rules related to the "area code" and "phone number" fields.
[0096] Using the event-driven mechanism, after the user selects the "country" field, the system will trigger an event, and then update the validation rules of other related fields.
[0097] In this embodiment, the specific method is,
[0098] Step 1: Listen for the user's selection of the "Country" field. In the Vue component, bind the value of the country field using the v-model directive. When the user selects a country, trigger an event or update the value of this field.
[0099] Step 2: Dynamically update the validation rules for the "Area Code" and "Phone Number" fields based on the country selected by the user.
[0100] Step 3: Use Vue's computed properties or watch listeners to dynamically update the validation rules for other fields based on changes in the "Country" field.
[0101] In another specific embodiment, a system device for form validation rule management includes:
[0102] A rule module for centrally storing and managing all form validation rules. The rules can include common form validation types such as email format, password strength, phone number, etc., and support parameterized configuration for flexible adjustment according to specific business requirements. Through the rule module, developers can uniformly define and modify form validation rules, improving the reusability and consistency of the rules.
[0103] An application module responsible for introducing the validation rules in the rule module into the actual form components. Whenever a user fills out and submits a form, the application module calls the validation function in the rule module to validate the form fields. If the validation fails, the system will display the corresponding error prompt message to remind the user to modify the input content.
[0104] A dynamic update module that enables rule modifications to automatically propagate to all form components when the form validation rules change, ensuring that all forms apply the latest validation rules. Developers only need to modify the relevant rules in the rule module, and other form components do not need to be adjusted manually.
[0105] A log recording module responsible for tracking and recording the results of each form validation, especially when the validation fails. The system will record the failed fields, the time of failure, and the reason for failure, helping developers analyze common problems in form validation and optimize them.
[0106] A rule dependency management module responsible for managing the validation rule dependency relationships between form elements. For example, the validation rules of some form fields may depend on the values of other fields, and the rule dependency management module will ensure the correctness of these dependency relationships. For example, the validation rule of a certain field may depend on the selection of another field, and the system will automatically adjust the rule to ensure the consistency of the validation.
[0107] A third aspect of the present invention discloses an electronic device. The electronic device includes a memory and a processor. The memory stores a computer program. When the processor executes the computer program, the steps in a method for managing form verification rules according to any one of the first aspects disclosed in the present invention are implemented.
[0108] Figure 2 As shown in the structural diagram of an electronic device according to an embodiment of the present invention, Figure 2 the electronic device includes a processor, a memory, a communication interface, a display screen, and an input device connected through a system bus. Among them, the processor of the electronic device is used to provide computing and control capabilities. The memory of the electronic device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The communication interface of the electronic device is used to communicate with an external terminal in a wired or wireless manner. The wireless manner can be implemented through WIFI, a carrier network, near field communication (NFC), or other technologies. The display screen of the electronic device can be a liquid crystal display screen or an electronic ink display screen. The input device of the electronic device can be a touch layer covered on the display screen, or a button, a trackball, or a touchpad provided on the housing of the electronic device, or an external keyboard, a touchpad, or a mouse, etc.
[0109] Those skilled in the art can understand that Figure 2 the structure shown in is only a structural diagram of a part related to the technical solution of the present disclosure, and does not constitute a limitation on the electronic device to which the solution of the present application is applied. A specific electronic device may include more or fewer components than those shown in the figure, or combine certain components, or have a different component layout.
[0110] A fourth aspect of the present invention discloses a computer-readable storage medium. A computer program is stored on the computer-readable storage medium. When the computer program is executed by a processor, the steps in a method for managing form verification rules according to any one of the first aspects disclosed in the present invention are implemented.
[0111] Please note that the technical features of the above embodiments can be combined arbitrarily. For the sake of concise description, not all possible combinations of the technical features in the above embodiments are described. However, as long as the combinations of these technical features do not conflict, they should be considered as the scope described in this specification. The above embodiments only express several implementation manners of the present application. Their descriptions are relatively specific and detailed, but they should not be construed as limiting the scope of the invention patent. It should be noted that for those of ordinary skill in the art, without departing from the concept of the present application, several deformations and improvements can still be made, and these all belong to the protection scope of the present application. Therefore, the protection scope of the patent of the present application should be subject to the appended claims.
[0112] The above are the preferred embodiments of the present invention. It should be noted that for those of ordinary skill in the art, without departing from the principle of the present invention, several improvements and modifications can be made, and these improvements and modifications should also be regarded as the protection scope of the present invention.
Claims
1. A method for managing form validation rules, characterized in that: The steps include: Step 1: Create a file for form validation rules, and centrally write common form validation rules in the form of functions in the file for creating form validation rules. The validation rules are configured to support dynamic configuration of rule parameters; Step 2: Use the mixins feature of the Vue framework to introduce the form verification rule file into the application file of the form verification rule to be used, and the application file of the form verification rule to be used shares a unified verification rule; Step 3: In the ElementUI validation function validator in the application file, directly call the validation rule function in the form validation rule file to implement form validation, and each validation rule function returns a preset error prompt message.
2. The method according to claim 1, characterized in that In step 1, the form validation rules include validation rules for a variety of form elements, including at least validation rules for numerical values, character combinations, and number arrangements.
3. The method according to claim 1, characterized in that: The validation rule function in the form validation rule file supports the refinement of specific rules through parameterized configuration.
4. The method according to claim 1, characterized in that When the validation rules are changed, the modification is made in the file of the form validation rules, and the modification is automatically updated to all forms using the validation rules through the characteristics of the framework.
5. A system for managing form verification, characterized in that: include: A rule module, wherein the rule module includes a form verification rule file, wherein the form verification rule file contains centrally written universal form verification rules, wherein the rules include at least verification rules for numerical values, character combinations, and number arrangements; An application module, wherein the application module includes an application file, wherein the application file is a file that introduces the form verification rules by utilizing the mixins feature of the Vue framework, and the verification of the application file is based on the form verification rules; The application file includes an ElementUI validation function validator for calling the form validation rule function, and returns a preset error prompt message when the validation function fails.
6. The system according to claim 5, characterized in that The form validation rules support dynamic parameter configuration.
7. The system according to claim 5, characterized in that It includes a log recording module, which is used to record failed verification information when the form verification fails. The failure message at least includes the verification time, the failure reason and the corresponding form element.
8. The system according to claim 5, characterized in that It includes a rule dependency management module, which is used to manage the verification rule dependency relationship between different form elements to ensure that when the verification rule of a form element changes, other related form elements maintain the consistency and integrity of the form verification.
9. An electronic device, characterized in that: The electronic device includes a memory and a processor, the memory stores a computer program, and when the processor executes the computer program, the steps in a method for managing form verification rules described in any one of claims 1 to 4 are implemented.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps in the method for managing form verification rules described in any one of claims 1 to 4 are implemented.