Mobile web form configuration and verification method, device, equipment and storage medium
By using preset arrays to configure multiple verification rules in mobile web forms, the problem that form elements cannot bind multiple verification rules in the existing technology is solved, and flexible verification logic configuration and complex verification mechanism are realized , improves the accuracy and user experience of form verification.
Patent Information
- Application Number
- CN202110188483.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-02-19
- Publication Date
- 2024-11-15
- Estimated Expiration
- 2041-02-19
AI Technical Summary
The prior art cannot satisfy the mechanism in which a form element binds multiple verification rules and multiple verification rules all satisfy or satisfy a failed callback, and the configuration items of the verification rule and the form element are one-to-one relationships. , complex verification logic configuration cannot be implemented.
Configure multiple verification rules for the same form element through a preset array, including rule names, rule rules, error prompts, trigger conditions and callback items, to realize multiple checksums of form contents, flexible customization of verification rules configuration. .
Implement a mechanism for binding multiple verification rules to a form element and all multiple verification rules satisfy or satisfy one failure callback, supporting the configuration and flexible customization of complex verification logic, improving the flexibility of form verification and accuracy.
Smart Images

Figure CN112800751B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of Internet technology, and in particular to a mobile terminal web page form configuration and verification method, device, equipment and storage medium. Background Art
[0002] With the continuous development of mobile Internet technology, the use of mobile web pages is becoming more and more frequent. The use of forms on mobile web pages has also become a common way for major applications to obtain user data. In order to verify the information entered by the user, the verification mechanism of the content of each input box is usually triggered when the form is submitted to prevent the user from entering incorrect or incomplete information and causing useless data collection. Therefore, the verification and validation of form content is also frequently used and necessary on mobile web pages.
[0003] The main disadvantages of the existing technology are as follows: there is mostly a one-to-one relationship between the configuration items of the verification rules and the form elements, which cannot meet the requirement of binding multiple verification rules to one form element, nor can it meet the mechanism of triggering a failure callback when one rule verification fails among multiple verification rules. Summary of the invention
[0004] In view of this, a mobile web form configuration and verification method, device, equipment and storage medium are provided to solve the problem in the related art that a form element cannot be bound to multiple verification rules and a mechanism of triggering a failure callback when all or one of the multiple verification rules are met is triggered.
[0005] The present invention adopts the following technical solution:
[0006] In a first aspect, an embodiment of the present invention provides a method for configuring and verifying a mobile web form, including:
[0007] Acquire form drawing information, and draw the page based on pre-packaged form components; each of the pre-packaged form components includes a type and a presentation style that define form elements;
[0008] Obtaining verification item configuration information, and configuring the verification item based on a preset verification rule configuration item; the verification rule configuration item includes multiple verification rules, the multiple rules are configured in the form of rule names, and the multiple verification rule names are placed in a preset array; configuring multiple verification rules for the same form element through the preset array;
[0009] Displaying the form for the user to fill out;
[0010] Verify the form filled in by the user based on the verification item configuration of the form.
[0011] Optionally, the types of the pre-encapsulated form components include: input box components, button components, form components and / or selector components.
[0012] Optionally, it also includes: the configuration type of the verification rule includes: rule regularity, error prompt, trigger condition and callback item.
[0013] Optionally, the rule is the only criterion for verifying the correctness of the form content;
[0014] The trigger condition is the timing of the form verification trigger.
[0015] Optionally, the triggering condition includes: a form item losing focus, a form item gaining focus, form submission and / or content change.
[0016] Optionally, the callback item includes:
[0017] If the verification is successful, the callback returns a successful status and enters the form submission interface;
[0018] If the verification fails, the callback returns a failed status, and the callback feedback configuration item is automatically read for callback.
[0019] Optionally, the callback feedback configuration items include: error prompt display position related settings and error item automatic focus function enablement settings.
[0020] In a second aspect, an embodiment of the present invention provides a mobile terminal web page form configuration and verification device, including:
[0021] A drawing module, used to obtain form drawing information and draw the page based on pre-packaged form components; each of the pre-packaged form components includes a type and a presentation style that define the form elements;
[0022] A verification configuration module is used to obtain verification item configuration information and configure the verification item based on a preset verification rule configuration item; the verification rule configuration item includes multiple verification rules, multiple rules are configured in the form of rule names, and multiple verification rule names are placed in a preset array; multiple verification rules are configured for the same form element through the preset array;
[0023] A display module, used to display the form for users to fill in;
[0024] The verification module is used to verify the form filled in by the user based on the verification item configuration of the form.
[0025] In a third aspect, an embodiment of the present invention provides a mobile terminal web page form configuration and verification device, including:
[0026] A processor, and a memory connected to the processor;
[0027] The memory is used to store a computer program, and the computer program is at least used to execute the mobile terminal web page form configuration and verification method provided in the present application;
[0028] The processor is used to call and execute the computer program in the memory.
[0029] In a fourth aspect, an embodiment of the present invention provides a storage medium, wherein the storage medium stores a computer program, and when the computer program is executed by a processor, the various steps in the mobile web form configuration and verification method provided in the present application are implemented.
[0030] The present invention adopts the above technical scheme, and when configuring the check items, first, the check item configuration information is obtained, and the check item configuration is performed based on the preset check rule configuration item; the check rule configuration item includes multiple check rules, and the multiple rules are configured in the form of rule names, and the multiple check rule names are placed in a preset array; multiple check rules are configured for the same form element through the preset array; such as the scheme provided by this application, multiple check rules can be configured for the same form element in an array manner to meet the requirements of binding multiple check rules to a form element and triggering a failure callback mechanism when all or one of the multiple check rules are met. BRIEF DESCRIPTION OF THE DRAWINGS
[0031] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0032] Figure 1 It is a flow chart of a mobile terminal web page form configuration and verification method provided by an embodiment of the present invention;
[0033] Figure 2 It is a schematic diagram of verification item configuration in a mobile terminal web page form configuration and verification method provided by an embodiment of the present invention;
[0034] Figure 3 It is a flow chart of a method for configuring and verifying a mobile webpage form provided by an embodiment of the present invention;
[0035] Figure 4 It is a structural diagram of a mobile terminal web page form configuration and verification device provided by an embodiment of the present invention;
[0036] Figure 5 It is a structural diagram of a mobile web page form configuration and verification device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0037] To make the purpose, technical solution and advantages of the present invention clearer, the technical solution of the present invention will be described in detail below. Obviously, the described embodiments are only part of the embodiments of the present invention, rather than all the embodiments. Based on the embodiments of the present invention, all other implementation methods obtained by ordinary technicians in this field without creative work belong to the scope of protection of the present invention.
[0038] First, the application scenario of the embodiment of the present invention is described. With the continuous development of mobile Internet technology, the use of mobile web pages is becoming more and more frequent, and the use of forms on mobile web pages is becoming a common way for major applications to obtain user data. In order to verify the information entered by the user, the verification mechanism of the content of each input box is usually triggered when the form is submitted to prevent the user from entering incorrect or incomplete information and causing useless data collection. Therefore, the verification and validation of the form content is also frequently used and necessary on mobile web pages.
[0039] At present, some existing mobile Web development frameworks have also begun to integrate their own commonly used form elements and verification mechanisms, including mandatory field verification, character length verification, phone and email verification, etc. The disadvantage is that once a more complex verification logic appears, it is not easy to configure custom verification rules and trigger events, and the verification steps and times are relatively large.
[0040] The basic idea of the existing mobile web form verification technology solution is to obtain the data in the form input box to be verified one by one when the form is submitted, and perform judgment verification simultaneously. If the verification fails, a prompt will be given and the verification will be stopped. The method and function are relatively simple.
[0041] At the same time, the basic idea of another technical solution is to configure the required items and length on the form elements, as well as the format type of the form input box, and restrict the user input or read these configurations in sequence when the form is submitted to verify whether the user input meets the requirements. The configuration function is relatively simple, and there is mostly a one-to-one relationship between the configuration items of the verification rules and the form elements.
[0042] In summary, the purpose of this application is to solve the two shortcomings of the above existing technologies. First, a unified set of form components is used to unify the form elements and the verification API. At the same time, the verification rules and verification callback methods are encapsulated inside the form elements. Developers can customize the required verification configuration through the form configuration file, including verification rules, prompt information, and interface feedback. Second, in the form of a rule array, multiple verification rules can be configured for a form element, and at the same time, it can be configured to determine whether the verification is passed by satisfying all or one of them, so as to realize flexible and customized verification rule configuration.
[0043] Example
[0044] Figure 1 is a flow chart of a mobile terminal web page form configuration and verification method provided by an embodiment of the present invention; Figure 1 , the method may specifically include the following steps:
[0045] S101, obtaining form drawing information, and drawing a page based on pre-packaged form components; each of the pre-packaged form components includes defining the type and presentation style of form elements;
[0046] The types of the pre-packaged form components include: input box components, button components, form components and / or selector components.
[0047] S102, obtaining verification item configuration information, and configuring the verification item based on a preset verification rule configuration item; the verification rule configuration item includes multiple verification rules, the multiple rules are configured in the form of rule names, and the multiple verification rule names are placed in a preset array; multiple verification rules are configured for the same form element through the preset array;
[0048] The types of the pre-packaged form components include: input box components, button components, form components and / or selector components.
[0049] It also includes: the configuration type of the verification rule includes: rule regularity, error prompt, trigger condition and callback item.
[0050] The rule is the only criterion for verifying the correctness of the form content;
[0051] The trigger condition is the timing of the form verification trigger.
[0052] The trigger conditions include: a form item losing focus, a form item gaining focus, form submission and / or content change.
[0053] Specifically, the callback items include:
[0054] If the verification is successful, the callback returns a successful status and enters the form submission interface;
[0055] If the verification fails, the callback returns a failed status, and the callback feedback configuration item is automatically read for callback.
[0056] The callback feedback configuration items include: error prompt display position related settings and error item automatic focus function settings.
[0057] S103, displaying the form for the user to fill in;
[0058] S104: Verify the form filled in by the user based on the verification item configuration of the form.
[0059] The present invention adopts the above technical scheme, and when configuring the check items, first, the check item configuration information is obtained, and the check item configuration is performed based on the preset check rule configuration item; the check rule configuration item includes multiple check rules, and the multiple rules are configured in the form of rule names, and the multiple check rule names are placed in a preset array; multiple check rules are configured for the same form element through the preset array; such as the scheme provided by this application, multiple check rules can be configured for the same form element in an array manner to meet the requirements of binding multiple check rules to one form element and triggering a failure callback mechanism when all or one of the multiple check rules are met.
[0060] Specifically, Figure 2 It is a schematic diagram of verification item configuration in a mobile terminal web page form configuration and verification method provided by an embodiment of the present invention; Figure 3 is a flow chart of a method for configuring and verifying a mobile web form provided by an embodiment of the present invention; Figure 2 , 3 , the mobile web form configuration and verification method provided by this application includes:
[0061] S301: Form drawing;
[0062] In this embodiment, the form component encapsulated by the present application is used to draw the page during the development process to define the type and presentation style of the form element.
[0063] It should be noted that the form components encapsulated in this application include but are not limited to input box components, button components, form components, selector components, etc.
[0064] S302: Verification item configuration;
[0065] Specifically, refer to Figure 2 The form element 21 is an instance of the form component described in S301, and the instance includes a validation rule configuration item rules attribute;
[0066] The verification rule configuration item 22 may include multiple verification rules, the rules are configured in the form of rule names, and receive data in the form of an array;
[0067] In this embodiment, if a form element contains multiple validation rules, multiple validation rule names need to be placed in an array. In addition, it is necessary to maintain rule configuration items corresponding to the rule names in the form validation configuration file, and the configuration items include rule regularity, error prompts, trigger conditions, callback items, etc.
[0068] The rule regular expression is the only standard for checking the correctness of the form content. The trigger condition is the time when the form check is triggered. The optional conditions include when the form item loses focus, gains focus, the form is submitted, and the content changes. When the form item meets the form trigger condition, the rule regular expression will be used to check the form content. If the check fails, the callback item will be triggered.
[0069] It should be noted that when the form item verification fails, if the item is configured with an error prompt, the error prompt will be automatically displayed in the interface in the form of a prompt box; if the item is not configured with an error prompt, it will not be displayed in the interface and can be uniformly configured through the callback item.
[0070] S303: callback feedback function configuration;
[0071] In this embodiment, if the form verification function is triggered in the page, a data validity check will be performed. If the check is successful, the callback return status is a success state, and the form submission operation can be performed; if the check fails, the callback return status is a failure state, and the callback feedback configuration item is automatically read for callback.
[0072] The callback feedback configuration items include:
[0073] The error prompt display position. The default is to display it in a prompt box, and the configurable items can also be displayed at the bottom of the form item.
[0074] Whether to enable the error item positioning function. The default is not enabled. If it is enabled, when the form item verification fails, the page can be automatically scrolled to the failed form item position.
[0075] Whether to enable the positioning prompt function. When the error item positioning function is enabled, this configuration item takes effect. It is enabled by default. After it is enabled, when the form item verification fails, the page can be automatically scrolled to the failed form item position and the text of the current form item will be marked in red.
[0076] Whether to enable the automatic focus function for error items. The default is not enabled. When it is enabled, when the form item verification fails, the failed form item can be automatically focused. Only form items in the form of input boxes are supported.
[0077] S304: Inject and bind configuration items;
[0078] In this embodiment, after the form is drawn, the check item is configured, and the callback feedback function is configured, the configuration item will be injected into the form component, and the form component encapsulates the function of reading and binding the configuration item.
[0079] Specifically, each form item configuration is distributed to the outer form element by means of JavaScript dispatching events. After the outer form obtains each form item configuration, it is inserted into the verification array in sequence and data binding is performed.
[0080] S305: trigger form verification;
[0081] In this embodiment, after the form content is updated, the form items that meet the triggering conditions will trigger the form verification function.
[0082] Specifically, if the trigger condition is the form item itself, it will be checked separately; if the trigger condition is the submission of the entire form, after the configuration items are injected and bound, all form items that need to be checked will be checked in turn. If one of them is not satisfied, an error callback will be made and the verification will end.
[0083] S306: Failure callback and interface feedback;
[0084] In this embodiment, if the form item verification fails, the callback feedback configured in S13 will be performed.
[0085] Preferably, if a global failure callback is defined when the form is submitted, the callback configuration items of each form item will be overwritten. After the failure callback, the user needs to re-update the form content to continue the verification.
[0086] S307: Submit the form;
[0087] In this embodiment, if the trigger condition is that the entire form is submitted, after all form items are successfully verified,
[0088] When the callback returns to a successful state, it enters a successful callback event, in which you can customize the subsequent functions, such as submitting a form.
[0089] S308: Reset the form;
[0090] This embodiment is the last step of form verification. After the form is submitted successfully, a form reset event will be triggered, which will traverse the form item data in sequence and perform initialization operations. The initialization content includes the value of the form item, the state of the form item, etc. At the same time, when the form content is updated, a method for resetting the form is also provided for the user to perform a reset operation.
[0091] Figure 4 is a structural diagram of a mobile terminal web page form configuration and verification device provided by an embodiment of the present invention; Figure 4 The mobile web form configuration and verification device provided by this application includes:
[0092] A drawing module 41, used to obtain form drawing information and draw a page based on pre-packaged form components; each of the pre-packaged form components includes a type and a presentation style of a defined form element;
[0093] The verification configuration module 42 is used to obtain verification item configuration information and configure the verification item based on a preset verification rule configuration item; the verification rule configuration item includes multiple verification rules, and the multiple rules are configured in the form of rule names, and the multiple verification rule names are placed in a preset array; multiple verification rules are configured for the same form element through the preset array;
[0094] A display module 43 is used to display the form for users to fill in;
[0095] The verification module 44 is used to verify the form filled in by the user based on the verification item configuration of the form.
[0096] Figure 5 is a structural diagram of a mobile terminal web form configuration and verification device provided by an embodiment of the present invention; Figure 5 The mobile web form configuration and verification device provided by this application includes:
[0097] A processor 51, and a memory 52 connected to the processor;
[0098] The memory 52 is used to store a computer program, and the computer program is at least used to execute the mobile terminal web page form configuration and verification method provided in the present application;
[0099] The processor is used to call and execute the computer program in the memory.
[0100] A storage medium stores a computer program, and when the computer program is executed by a processor, each step of the mobile terminal web page form configuration and verification method provided in the present application is implemented.
[0101] It can be understood that the same or similar parts of the above embodiments can be referenced to each other, and the contents not described in detail in some embodiments can refer to the same or similar contents in other embodiments.
[0102] It should be noted that, in the description of the present invention, the terms "first", "second", etc. are only used for descriptive purposes and cannot be understood as indicating or implying relative importance. In addition, in the description of the present invention, unless otherwise specified, the meaning of "plurality" refers to at least two.
[0103] Any process or method description in a flowchart or otherwise described herein may be understood to represent a module, segment or portion of code that includes one or more executable instructions for implementing the steps of a specific logical function or process, and the scope of the preferred embodiments of the present invention includes alternative implementations in which functions may not be performed in the order shown or discussed, including performing functions in a substantially simultaneous manner or in the reverse order depending on the functions involved, which should be understood by those skilled in the art to which the embodiments of the present invention belong.
[0104] It should be understood that the various parts of the present invention can be implemented by hardware, software, firmware or a combination thereof. In the above-mentioned embodiments, a plurality of steps or methods can be implemented by software or firmware stored in a memory and executed by a suitable instruction execution system. For example, if implemented by hardware, as in another embodiment, it can be implemented by any one of the following technologies known in the art or their combination: a discrete logic circuit having a logic gate circuit for implementing a logic function for a data signal, a dedicated integrated circuit having a suitable combination of logic gate circuits, a programmable gate array (PGA), a field programmable gate array (FPGA), etc.
[0105] A person skilled in the art may understand that all or part of the steps in the method for implementing the above-mentioned embodiment may be completed by instructing related hardware through a program, and the program may be stored in a computer-readable storage medium, which, when executed, includes one or a combination of the steps of the method embodiment.
[0106] In addition, each functional unit in each embodiment of the present invention may be integrated into a processing module, or each unit may exist physically separately, or two or more units may be integrated into one module. The above-mentioned integrated module may be implemented in the form of hardware or in the form of a software functional module. If the integrated module is implemented in the form of a software functional module and sold or used as an independent product, it may also be stored in a computer-readable storage medium.
[0107] The storage medium mentioned above can be a read-only memory, a magnetic disk or an optical disk, etc.
[0108] In the description of this specification, the description with reference to the terms "one embodiment", "some embodiments", "examples", "specific examples", or "some examples" means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present invention. In this specification, the schematic representation of the above terms does not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described may be combined in any one or more embodiments or examples in a suitable manner.
[0109] Although the embodiments of the present invention have been shown and described above, it is to be understood that the above embodiments are exemplary and are not to be construed as limitations of the present invention. A person skilled in the art may change, modify, replace and vary the above embodiments within the scope of the present invention.
Claims
1. A method for configuring and verifying a mobile web form, characterized in that: include: Get form drawing information and draw the page based on the pre-packaged form components; Each of the pre-packaged form components includes a type and a presentation style that define the form element; Obtain verification item configuration information, and configure verification items based on preset verification rule configuration items; The verification rule configuration item includes multiple verification rules, and the multiple rules are configured in the form of rule names, and the multiple verification rule names are placed in a preset array; Configure multiple validation rules for the same form element through a preset array; Displaying the form for the user to fill out; Verify the form filled in by the user based on the verification item configuration of the form; The rule is the only criterion for checking the correctness of the form content; The trigger condition is the timing of the form validation trigger; The trigger conditions include: the form item loses focus, the form item gains focus, the form is submitted and / or the content changes; The configuration type of the verification rule includes: rule regularity, error prompt, trigger condition and callback item; The callback items include: If the verification is successful, the callback returns a successful status and enters the form submission interface; If the verification fails, the callback returns a failed status, and the callback feedback configuration item is automatically read for callback; The callback feedback configuration items include: error prompt display position related settings and error item automatic focus function settings.
2. The mobile terminal web page form configuration and verification method according to claim 1, characterized in that: The types of the pre-packaged form components include: at least one of an input box component, a button component, a form component, and a selector component.
3. A mobile terminal web form configuration and verification device, characterized in that: include: The drawing module is used to obtain form drawing information and draw the page based on the pre-packaged form components; Each of the pre-packaged form components includes a type and a presentation style that define the form element; The verification configuration module is used to obtain verification item configuration information and configure the verification items based on the preset verification rule configuration items; The verification rule configuration item includes multiple verification rules, and the multiple rules are configured in the form of rule names, and the multiple verification rule names are placed in a preset array; Configure multiple validation rules for the same form element through a preset array; A display module, used to display the form for users to fill in; A verification module, used to verify the form filled in by the user based on the verification item configuration of the form; The rule is the only criterion for checking the correctness of the form content; The trigger condition is the timing of the form validation trigger; The trigger conditions include: the form item loses focus, the form item gains focus, the form is submitted and / or the content changes; The configuration type of the verification rule includes: rule regularity, error prompt, trigger condition and callback item; The callback items include: If the verification is successful, the callback returns a successful status and enters the form submission interface; If the verification fails, the callback returns a failed status, and the callback feedback configuration item is automatically read for callback; The callback feedback configuration items include: error prompt display position related settings and error item automatic focus function settings.
4. A mobile terminal web form configuration and verification device, characterized in that: include: A processor, and a memory connected to the processor; The memory is used to store a computer program, and the computer program is used at least to execute the mobile terminal web page form configuration and verification method according to any one of claims 1-2; The processor is used to call and execute the computer program in the memory.
5. A storage medium, characterized in that: The storage medium stores a computer program, and when the computer program is executed by the processor, each step in the mobile web page form configuration and verification method as described in any one of claims 1-2 is implemented.
Citation Information
Patent Citations
Information prompting method, server, mobile terminal and system
CN105786861A
Form verification method and device
CN108804399A
Webpage form filling method and device
CN110018766A
Form verification method and device, computer equipment and storage medium
CN110334303A
Method and device for realizing draggable custom form component based on mobile terminal
CN111597489A
