CN109657178B - Page form processing method and device, computer equipment and storage medium - Google Patents

Page form processing method and device, computer equipment and storage medium Download PDF

Info

Publication number
CN109657178B
CN109657178B CN201811339106.9A CN201811339106A CN109657178B CN 109657178 B CN109657178 B CN 109657178B CN 201811339106 A CN201811339106 A CN 201811339106A CN 109657178 B CN109657178 B CN 109657178B
Authority
CN
China
Prior art keywords
control
name
browser
control name
submitted
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201811339106.9A
Other languages
Chinese (zh)
Other versions
CN109657178A (en
Inventor
许永夫
李培光
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Ping An Technology Shenzhen Co Ltd
Original Assignee
Ping An Technology Shenzhen Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Ping An Technology Shenzhen Co Ltd filed Critical Ping An Technology Shenzhen Co Ltd
Priority to CN201811339106.9A priority Critical patent/CN109657178B/en
Publication of CN109657178A publication Critical patent/CN109657178A/en
Application granted granted Critical
Publication of CN109657178B publication Critical patent/CN109657178B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
  • Information Transfer Between Computers (AREA)

Abstract

The invention discloses a page form processing method, a page form processing device, computer equipment and a storage medium. The method comprises the following steps: if the version information of the browser meets the preset version compatibility requirement, acquiring a form control in the form to be submitted; checking the control name of each form control according to the pre-stored change relation of the control name before and after dynamic setting in each browser version in a preset control data table, and if the control name of the form control is the control name after dynamic setting, replacing the attribute definition of the control name after dynamic setting in the form control with the attribute definition of the control name before dynamic setting to obtain an updated form to be submitted; analyzing the updated form to be submitted, and sending the form data obtained through analysis to a server. According to the technical scheme, form data analysis errors caused by control name change are avoided, and compatibility of incompatible browser versions is improved.

Description

Page form processing method and device, computer equipment and storage medium
Technical Field
The present invention relates to the field of computer technologies, and in particular, to a method and apparatus for processing a page form, a computer device, and a storage medium.
Background
With the continuous development of internet technology, browser products are not only of a wide variety, but also frequently updated in version. Because the information technology is updated rapidly, new products are often difficult to be compatible with the design of old products; some old software libraries are abandoned, and the software libraries are replaced by more efficient and concise versions, so that the software libraries are strategies which are required to be adopted by a plurality of browser product providers, and meanwhile, new browser technologies are continuously followed by Web development based on the browser, so that various compatibility problems are brought to old Web systems which are still in service.
For example, many browser application pages provide a function of inputting user information, a user inputs related information through an input box control provided by the browser application page, and after the browser uses a JavaScript script of a local cache to analyze a Form of the application page, the Form data obtained by analysis is submitted to a background server for further processing. However, in some application scenarios, the name of the input box control is not fixed, and dynamic setting needs to be performed according to the application needs through JavaScript script, so as to ensure that the name agreed with the server is consistent. However, due to compatibility problems between browser versions, for a browser with a low version, after the attribute values of the control names are dynamically set through the JavaScript script, the control names are changed, so that the server cannot acquire the corresponding control values through the agreed control name attribute values.
For example, for an input control of < input type= "text" name= "username" value= "zhangsan" >, when an attribute value of a control name of the input control is dynamically changed through a command input.
Disclosure of Invention
The embodiment of the invention provides a form page processing method, a form page processing device, computer equipment and a storage medium, which are used for solving the problem that a form data analysis error is caused because a control name is changed when an attribute value of the control name is dynamically set in a low-version browser, and a server cannot accurately acquire form data.
A form page processing method, comprising:
if the operation that the user submits through the browser page touch form is detected, version information of the browser is obtained;
If the version information meets the preset version compatibility requirement, acquiring a form control in the form to be submitted;
checking the control name of each form control according to the pre-stored change relation of the control name before and after dynamic setting in each browser version in a preset control data table, if the control name of the form control is the control name after dynamic setting, taking the form control as a control to be processed, taking the control name after dynamic setting as a target control name, and taking the control name of the target control name before dynamic setting as a source control name;
replacing the attribute definition of the target control name in the to-be-processed control with the attribute definition of the source control name to obtain the updated to-be-submitted form;
and analyzing the updated form to be submitted, and sending the form data obtained by analysis to a server.
A form page processing apparatus comprising:
the version acquisition module is used for acquiring version information of the browser if detecting the operation submitted by the user through the page touch form of the browser;
the control acquisition module is used for acquiring a form control in a form to be submitted if the version information meets the preset version compatibility requirement;
The checking module is used for checking the control name of each form control according to the pre-stored change relation of the control name in each browser version before and after dynamic setting in a preset control data table, if the control name of the form control is the control name after dynamic setting, the form control is used as a control to be processed, the control name after dynamic setting is used as a target control name, and the control name of the target control name before dynamic setting is used as a source control name;
the updating module is used for replacing the attribute definition of the target control name in the control to be processed with the attribute definition of the source control name to obtain the updated form to be submitted;
and the analysis module is used for analyzing the updated form to be submitted and transmitting the form data obtained by analysis to a server.
A computer device comprising a memory, a processor and a computer program stored in the memory and executable on the processor, the processor implementing the steps of the form page processing method described above when the computer program is executed.
A computer readable storage medium storing a computer program which when executed by a processor implements the steps of the form page processing method described above.
In the form page processing method, the device, the computer equipment and the storage medium, if the operation that a user submits a form through a browser page is detected, version information of the browser is obtained, when the version information meets the preset version compatibility requirement, the form name of a form control in a form to be submitted is checked according to the change relation of the control name before and after dynamic setting in each browser version pre-stored in a preset control data table, if the control name of the form control is the control name after dynamic setting, attribute definition of the control name after dynamic setting in the form control is replaced by attribute definition of the control name before dynamic setting according to the change relation pre-stored in a control data table, and the updated form to be submitted is obtained, so that when the updated form to be submitted is analyzed, the form name can be accurately analyzed and sent to a server side, and the form analysis error caused by the change of the control name in the attribute value of the control name in the incompatible browser is realized, so that the server side can obtain the correct and the compatible form data of the incompatible version can be avoided. Meanwhile, the old Web system does not need to be redesigned and developed, and the development cost is saved.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings that are needed in the description of the embodiments of the present invention will be briefly described below, it being obvious that the drawings in the following description are only some embodiments of the present invention, and that other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
FIG. 1 is a schematic diagram of an application environment of a page form processing method according to an embodiment of the present invention;
FIG. 2 is a flow chart of a method of processing a page form in an embodiment of the invention;
FIG. 3 is a flowchart of step S4 in a page form processing method according to an embodiment of the present invention;
FIG. 4 is a flowchart of a page form processing method according to an embodiment of the present invention, in which version information of a browser is acquired in step S1;
FIG. 5 is a flowchart of step S5 in a page form handling method according to an embodiment of the present invention;
FIG. 6 is a schematic diagram of a page form handling device according to an embodiment of the invention;
FIG. 7 is a schematic diagram of a computer device in accordance with an embodiment of the invention.
Detailed Description
The following description of the embodiments of the present invention will be made clearly and fully with reference to the accompanying drawings, in which it is evident that the embodiments described are some, but not all embodiments of the invention. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention.
The page form processing method provided by the application can be applied to an application environment shown in fig. 1, wherein the application environment comprises a server and a client, the server and the client are connected through a network, the network can be a wired network or a wireless network, the client specifically comprises but is not limited to various personal computers, notebook computers, smart phones, tablet computers and portable wearable devices, and the server can be specifically realized by a server cluster formed by independent servers or a plurality of servers. The client performs compatibility processing on the form to be submitted according to the version information of the browser, and sends the parsed form data to the server so that the server can correctly acquire the form data.
In one embodiment, as shown in fig. 2, a method for processing a page form is provided, and the method is applied to the client in fig. 1 as an example, and is described in detail as follows:
s1: and if the operation of submitting the user through the browser page touch form is detected, acquiring version information of the browser.
Specifically, in a scenario that a user inputs related information according to an input control provided by a browser page, such as a login page or a registration page, after the user inputs login information or registration information in the input control, when clicking a corresponding submit button, that is, when triggering a form submit operation, a client acquires version information of the browser when detecting the form submit triggering operation.
The version information of the browser is related information that the browser product provider uses to inform the user of the functions provided by the browser currently being used. For example, version information of an IE11 browser of microsoft corporation is IE11.1198.14393.0, version information of a Chrome browser of google corporation is chrome69.0.3497.100, and version information of a Firefox open source browser is Firefox61.0.2. Wherein, the number before the first decimal point represents the large version number of the current browser, and the large version number is the main identification information for distinguishing whether the browser supports a certain function.
The obtaining of the version information of the browser can be achieved by executing a preset JavaScript. The JavaScript script is an transliteration script language, is a dynamic type, weak type and prototype-based language, and is internally provided with a support type. Its interpreter is called JavaScript engine, which is widely used on clients as part of a browser, typically to add dynamic functionality to HTML web pages.
S2: and if the version information of the browser meets the preset version compatibility requirement, acquiring a form control in the form to be submitted.
Specifically, the preset version compatibility requirement is used for judging that compatibility processing is needed for the form to be submitted of the current browser. For example, the preset version compatibility requirement may be a browser version below IE 8.
And (3) judging whether the version information meets the preset version compatibility requirement according to the version information of the current browser acquired in the step (S1), taking a browser version with the version compatibility requirement lower than IE8 as an example, if the version number of the current browser is IE6, confirming that the version information of the browser meets the preset version compatibility requirement, and acquiring a form control in a form to be submitted.
The Form to be submitted can be a Form, and is mainly responsible for a data acquisition function in a webpage, and is generally composed of three parts, namely a Form label, a Form field and a Form button, wherein the Form field comprises Form controls such as a text box, a password box, a check box, a radio box, a drop-down selection box, a file uploading box and the like. Each form control includes a control type, a control name, and a control value. For example, < input type= "text" name= "username" value= "zhangsan" > is a text box input control, where the control type is text, the control name is username, and the control value is zhangsan.
S3: checking the control name of each form control according to the pre-stored change relation of the control name before and after dynamic setting in each browser version in a preset control data table, if the control name of the form control is the control name after dynamic setting, taking the form control as a control to be processed, taking the control name after dynamic setting as a target control name, and taking the control name of the target control name before dynamic setting as a source control name.
Specifically, after the user inputs related information through an input box control provided by the browser application page, the browser of the client uses the locally cached JavaScript script to analyze the Form of the application page, and submits the Form data obtained by analysis to the server for further processing. Because in some application scenarios, the control name of the input box control is not fixed, the attribute value of the control name needs to be dynamically set according to the application requirement through the JavaScript script, so as to ensure that the name agreed with the server is consistent. However, due to compatibility problems between browser versions, in some low-version browsers, when the attribute values of the control names are dynamically set through JavaScript scripts, the control names change. The preset control data table is a pre-stored change relation of the control names in different browser versions before and after dynamic setting, namely a mapping relation between the control names before the attribute values of the control names are dynamically set and the control names after the attribute values of the control names are dynamically set.
It will be appreciated that the control data table may include fields for version information, control type, control name before dynamically setting the attribute value of the control name, and control name after dynamically setting the attribute value of the control name.
For example, for an input control of < input type= "text" name= "username" value= "zhangsan" >, in the IE6 version, when the attribute value of the name is dynamically set, the control name becomes the sub-mitname, i.e. the input control becomes < input type= "text" sub-mitname= "personname" value= "zhangsan" >, therefore, the mapping relationship between the control name and the sub-mitname of the IE6 version input control is stored in the control data table, i.e. one data record of the control data table may be as follows:
inquiring a data record corresponding to version information of a current browser in a preset control data table, taking a field, which is a control name after an attribute value of the control name is dynamically set in the control data table, as a target field, acquiring a value of the target field in the inquired data record, traversing each form control, further checking whether the control name of the form control exists in the value of the target field corresponding to the control type of the form control if the control type of the form control is contained in the inquired data record, taking the form control name as a to-be-processed control if the control name of the form control exists in the acquired value of the target field, taking the control name of the form control, which is the control name after the dynamic setting, as the target control name, and acquiring the value of the field, which is the control name before the attribute value of the control name is dynamically set, from the record in which the target control name exists in the inquired data record of the control data table.
It should be noted that, if the control name of each form control does not find the corresponding record in the control data table, it is confirmed that the form to be submitted does not need to be subjected to compatible processing, and the processing procedure of parsing and sending the form to be submitted in step S5 is directly executed.
S4: and replacing the attribute definition of the target control name in the to-be-processed control with the attribute definition of the source control name to obtain an updated to-be-submitted form.
Specifically, according to the source control name and the target control name determined in the step S3, deleting the original attribute definition of the target control name in the to-be-processed controls, replacing the attribute definition of the source control name, and after each to-be-processed control in the form to be submitted is subjected to replacement processing of the attribute definition, obtaining the updated form to be submitted.
For example, if the to-be-processed control is < input type= "text" subtname= "persona" value= "zhangsan" >, where the subtname is the target control name and its corresponding source control name is name, the subtname= "persona" defined for the attribute of the subtname in the to-be-processed control is deleted, and the name= "persona" is used for replacement, and the to-be-processed control is updated to < input type= "text" name= "persona" value= "zhangsan" >, in the obtained updated to-be-submitted form.
S5: analyzing the updated form to be submitted, and sending the form data obtained through analysis to a server.
In this embodiment, according to the updated form to be submitted obtained in step S4, the form to be submitted is parsed, the value of each control in the form to be submitted is obtained, form data in the form of key-value is obtained, and submitted to the server. Wherein, the key is the control name, and the value is the attribute value of the control name.
For example: the control value obtained after parsing the control of < input type= "text" name= "username" value= "zhangsan" >: username = zhangsan.
In this embodiment, if it is detected that a user triggers an operation of form submission through a browser page, version information of the browser is obtained, when the version information meets a preset version compatibility requirement, according to a change relation of a control name in each browser version pre-stored in a preset control data table before and after dynamic setting, the control name of a form control in a form to be submitted is checked, if the control name of the form control is a control name after dynamic setting, according to a change relation pre-stored in a control data table, attribute definition of the control name after dynamic setting in the form control is replaced with attribute definition of the control name before dynamic setting, so that an updated form to be submitted can be accurately parsed and sent to a server side, and when an attribute value of the control name in an incompatible browser version is dynamically set, form data caused by form name change can be correctly and conveniently obtained by the server side, and compatibility of the incompatible browser version is improved. Meanwhile, the old Web system does not need to be redesigned and developed, and the development cost is saved.
In one embodiment, as shown in fig. 3, in step S4, the attribute definition of the name of the target control in the to-be-processed control is replaced by the attribute definition of the name of the source control, so as to obtain an updated to-be-submitted form, which specifically includes the following steps:
s41: and acquiring an attribute value of the target control name in the control to be processed, and deleting the attribute definition of the target control name.
Specifically, in the control to be processed, the attribute value of the target control name is obtained from the attribute definition of the target control name, the attribute value is temporarily cached, and meanwhile, the attribute definition of the target control name is deleted.
For example, for an input to-be-processed control of < input type= "text" subtname= "personname" value= "zhangsan" >, the subtname target control name corresponds to the source control name. In order to delete the attribute definition of the name subtname of the target control in the JavaScript script, the deleted control to be processed is: < input type= "text" value= "zhangsan" >, while caching the attribute value personname of the subtname.
S42: and newly adding attribute definition of a preset basic control name in the control to be processed, and assigning an attribute value of the target control name to the basic control name.
Specifically, on the basis of deleting the attribute definition of the target control name, an attribute definition of the preset basic control name is newly added, and in the attribute definition, the attribute value of the target control name cached in step S41 is used as the attribute value of the basic control name.
Continuing to take the input control to be processed in the step S42 as an example, the deleted control to be processed is: < input type= "text" value= "zhangsan" >, if the preset basic control name is title, using input. Setattribute ('title', persona) to newly add attribute definition to title, assigning persona to title, as attribute value of title, the newly added control to be processed is: < input type= "text" title= "personname" value= "zhangsan" >.
S43: and replacing the basic control name in the control to be processed with the source control name.
Specifically, the basic control name is replaced by the source control name on the basis of newly adding the attribute definition of the basic control name.
Continuing to take the input control to be processed in step S43 as an example, the newly added control to be processed is: < input type= "text" title= "personname" value= "zhangsan" >, replacing title with source control name, and then replacing the to-be-processed control with: < input type= "text" name= "personname" value= "zhangsan" >.
In the embodiment, the attribute value of the target control name is obtained from the control to be processed, the attribute definition of the target control name is deleted, the attribute definition of the preset basic control name is newly added on the basis, the attribute value of the target control name is assigned to the basic control name, and then the basic control name is replaced by the source control name, so that the control name is quickly and conveniently replaced, and particularly, the process of replacing processing can be completed by directly calling the encapsulation function in JavaScript, and the method is simple, convenient and fast and high in universality.
In one embodiment, the version information includes a browser type and a browser version number.
The browser type is used for identifying the product name of the browser, and the browser version number is a specific product version number. For example, the browser type of the version information IE11.1198.14393.0 is IE, the browser version number is 11.1198.14393.0, the version information chrome69.0.3497.100 of the Chrome browser of google company, the browser type is Chrome, the browser version number is 69.0.3497.100, the version information Firefox61.0.2 of the open source browser Firefox browser, the browser type is Firefox, and the browser version number is 61.0.2.
Further, as shown in fig. 4, in step S1, version information of the browser is acquired, which specifically includes the following steps:
s11: a user agent string of the browser is obtained.
Specifically, a User Agent (UA) string is a special string, and information such as an operating system and version, a CPU type, a browser and version, a browser rendering engine, a browser language, and a browser plug-in can be obtained through the UA string.
In JavaScript, the user agent string of the browser can be obtained using the function navigator. For example, taking the IE11 browser as an example, by calling navigator. Useragent (), the user agent string of the browser is: IE/11.1198.14393.0.
S12: and extracting the browser model and the browser version number from the user agent character string according to the information structure preset by the user agent character string.
Specifically, according to the user agent character string obtained in step S11, the user agent character string is parsed according to a preset information structure, and the corresponding browser model and browser version number are extracted from the user agent character string.
For example, if the user agent string is: IE/11.1198.14393.0, according to the preset "/", the substring before the user agent string "/" "is used as the browser model, and the substring after the user agent string"/"" is used as the browser version number.
It should be noted that, since, in the browser version number, the number before the first decimal point represents the large version number of the browser, in general, the large version number is the main identification information for distinguishing whether the browser supports a certain function, when extracting the browser version number, the number before the first decimal point may also be extracted according to the application requirement, for example, for the user agent character string: IE/11.1198.14393.0, the browser version number can be extracted to be 11 according to the application requirement.
In the embodiment, the browser model and the browser version number are obtained by acquiring the user agent character string of the browser and analyzing the user agent character string according to the preset information structure, the implementation mode is simple and universal, and the result is accurate.
In one embodiment, in step S2, if the version information of the browser meets the preset version compatibility requirement, the form control in the form to be submitted is obtained, which specifically includes the following steps:
and if the browser type belongs to a preset target browser and the browser version number is smaller than a preset version number threshold, acquiring a form control in the form to be submitted.
Specifically, according to the browser type and the browser version number obtained in the step S12, when the browser type belongs to a preset target browser and the browser version number is smaller than a preset version number threshold, it is confirmed that the form to be submitted needs to be subjected to compatible processing, and a form control in the form to be submitted is obtained.
In this embodiment, since the browser versions are numbered differently by different browser products, and the compatibility problem of dynamically setting the attribute values of the control names in different browser products may also be different, whether the forms to be submitted need to be subjected to compatibility processing is comprehensively determined by the browser type and the browser version number, so that a determination result can be obtained more reasonably, and an incompatible browser version can be accurately identified.
In one embodiment, as shown in fig. 5, in step S5, the updated form to be submitted is parsed, and the form data obtained by parsing is sent to the server, which specifically includes the following steps:
s51: and according to preset verification conditions, verifying the validity of the updated contents of the form to be submitted.
Specifically, before submitting form data, validity verification needs to be performed on the content in the updated form to be submitted, especially the information input by the user through the input box, so as to ensure that the content is valid.
The content of the validity verification includes, but is not limited to, verification of the length of the input character string, verification of the character string format, verification of the shielding keyword, verification of the validity of the character string content, and the like. The verification of the character string format comprises the format verification of various input character strings such as a mailbox, a registration name, a password and the like, and the verification of the validity of the character string content comprises the verification of whether the two passwords are consistent, whether the mail address is legal, whether the Chinese name or the English name is legal and the like.
The preset verification conditions are specifically set according to the needs of practical applications, and are not limited herein, for example, the input password length is not less than 6-bit characters.
S52: and if the validity verification is passed, acquiring the receiving address information of the server from the form label of the updated form to be submitted, and analyzing the content of each form control according to the type of each form control in the updated form to be submitted to obtain the control content corresponding to each form control.
Specifically, if the validity verification in step S51 is passed, it is confirmed that the content in the updated form to be submitted is valid and can be submitted to the server for processing. The updated form to be submitted comprises three parts, namely a form label, a form domain and a form button, wherein the form label comprises a uniform resource locator (Uniform Resource Locator, URL) of a universal network management interface (Common Gateway Interface, CGI) program used by a server for processing form data, and a submitting mode for submitting the form data to a server.
And acquiring the URL from the form label of the updated form to be submitted, namely the receiving address information of the server. For example, the form labels are: < action= "http:// wichkelysmart.com/hfhtmlccs/confest.php" method= "post" >, the received address information obtained is http:// wichkelysmart.com/hfhtmlccs/confest.php, i.e. the form data needs to be submitted to the confest.php script in the hftmlcss folder in the wichkelysmart.com link for processing.
And analyzing the content of each form control according to the type of each form control in the updated form to be submitted to obtain the control content in the key-value form corresponding to each form control.
For example, for an input form control of the text type of < input type= "text" name= "username" value= "zhangsan" >, according to the control attribute definition corresponding to the text type, the control attribute corresponding to the text type includes name and value, the content of the form control is parsed to obtain the control content in the form of key-value, the key is username, the value is zhangsan, that is, the control content corresponding to the form control is username=zhangsan is parsed.
S53: and forming the control content corresponding to each form control into form data, and transmitting the form data to a position corresponding to the receiving address information.
Specifically, the control content of each form control obtained in step S52 is serialized into a character string according to a preset combination manner, so as to generate form data, for example, the serialized character string can be implemented by using querystring.
And (3) transmitting the form data to a position corresponding to the received address information acquired in the step S52, so that the server receives and processes the form data in the processing script of the received address information.
In this embodiment, according to a preset verification condition, validity verification is performed on the content of the updated form to be submitted, validity verification is performed to ensure that the content in the updated form to be submitted is legal and valid, and the content can be submitted to a server for processing, so that verification which is originally required to be performed at the server can be performed by dispersing each client through a simple JavaScript code, the same effect can be achieved, and therefore the operation load of the server is reduced, and the execution efficiency of the server is improved; after the validity verification is passed, the receiving address information of the server is obtained from the updated form label of the form to be submitted, the content of each form control is analyzed into control content in a key-value form, the control content is serialized into a character string, form data is generated, the form data is sent to the position corresponding to the receiving address information, the transmission efficiency is effectively improved in a mode of serializing the control content into the character string, and meanwhile, the transmission safety of the form data can be improved to a certain extent in a serialization mode.
It should be understood that the sequence number of each step in the foregoing embodiment does not mean that the execution sequence of each process should be determined by the function and the internal logic, and should not limit the implementation process of the embodiment of the present invention.
In one embodiment, a page form processing device is provided, where the page form processing device corresponds to the page form processing method in the above embodiment one by one. As shown in fig. 6, the page form processing apparatus includes a version acquisition module 61, a control acquisition module 62, a check module 63, an update module 64, and an analysis module 65. The functional modules are described in detail as follows:
the version obtaining module 61 is configured to obtain version information of the browser if an operation of submitting the user through the browser page touch form is detected;
the control acquisition module 62 is configured to acquire a form control in a form to be submitted if version information of the browser meets a preset version compatibility requirement;
the checking module 63 is configured to check the control name of each form control according to a pre-stored change relationship of the control name in each browser version before and after dynamic setting in a preset control data table, if the control name of the form control is the control name after dynamic setting, take the form control as a control to be processed, take the control name after dynamic setting as a target control name, and take the control name of the target control name before dynamic setting as a source control name;
The updating module 64 is configured to replace an attribute definition of a target control name in the to-be-processed control with an attribute definition of a source control name to obtain an updated to-be-submitted form;
the parsing module 65 is configured to parse the updated form to be submitted, and send the form data obtained by parsing to the server.
Further, the update module 64 includes:
a deleting sub-module 641, configured to obtain an attribute value of the target control name in the control to be processed, and delete an attribute definition of the target control name;
the new adding sub-module 642 is configured to add a new attribute definition for a preset basic control name in the control to be processed, and assign an attribute value of the target control name to the basic control name;
and a replacing sub-module 643, configured to replace the basic control name in the to-be-processed control with the source control name.
Further, the version information includes a browser type and a browser version number, and the version acquisition module 61 includes:
a user agent acquisition sub-module 611, configured to acquire a user agent character string of the browser;
the extracting sub-module 612 is configured to extract the browser type and the browser version number from the user agent string according to the information structure preset by the user agent string.
Further, the control acquisition module 62 is further configured to:
and if the browser type belongs to a preset target browser and the browser version number is smaller than a preset version number threshold, acquiring a form control in the form to be submitted.
Further, the parsing module 65 includes:
the verification sub-module 651 is used for verifying the validity of the updated contents of the form to be submitted according to preset verification conditions;
the content analysis sub-module 652 is configured to obtain, if the validity verification is passed, the receiving address information of the server from the form label of the updated form to be submitted, and analyze, according to the type of each form control in the updated form to be submitted, the content of each form control, to obtain the control content corresponding to each form control;
the assembly sending sub-module 653 is configured to compose the control content corresponding to each form control into form data, and send the form data to a position corresponding to the receiving address information.
The specific limitation of the page form processing device may be referred to as limitation of the page form processing method hereinabove, and will not be described herein. The respective modules in the above-described page form processing apparatus may be implemented in whole or in part by software, hardware, and a combination thereof. The above modules may be embedded in hardware or may be independent of a processor in the computer device, or may be stored in software in a memory in the computer device, so that the processor may call and execute operations corresponding to the above modules.
In one embodiment, a computer device is provided, which may be a terminal, and the internal structure of which may be as shown in fig. 7. The computer device includes a processor, a memory, a network interface, a display screen, and an input device connected by a system bus. Wherein the processor of the computer device is configured to provide computing and control capabilities. The memory of the computer 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 computer programs in the non-volatile storage media. The network interface of the computer device is for communicating with an external server via a network connection. The computer program is executed by a processor to implement a page form processing method.
In an embodiment, a computer device is provided, including a memory, a processor, and a computer program stored in the memory and capable of running on the processor, where the processor implements the steps of the page form processing method of the foregoing embodiment, such as steps S1 to S5 shown in fig. 1, when executing the computer program, or implements the functions of each module/unit of the page form processing apparatus of the foregoing embodiment, such as the functions of modules 61 to 65 shown in fig. 6, when executing the computer program. To avoid repetition, no further description is provided here.
In an embodiment, a computer readable storage medium is provided, on which a computer program is stored, where the computer program when executed by a processor implements the method for processing a page form in the above method embodiment, or where the computer program when executed by a processor implements the functions of each module/unit in the page form processing device in the above device embodiment. To avoid repetition, no further description is provided here.
Those skilled in the art will appreciate that implementing all or part of the above described methods may be accomplished by way of a computer program stored on a non-transitory computer readable storage medium, which when executed, may comprise the steps of the embodiments of the methods described above. Any reference to memory, storage, database, or other medium used in the various embodiments provided herein may include non-volatile and/or volatile memory. The nonvolatile memory can include Read Only Memory (ROM), programmable ROM (PROM), electrically Programmable ROM (EPROM), electrically Erasable Programmable ROM (EEPROM), or flash memory. Volatile memory can include Random Access Memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in a variety of forms such as Static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double Data Rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous Link DRAM (SLDRAM), memory bus direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), among others.
It will be apparent to those skilled in the art that, for convenience and brevity of description, only the above-described division of the functional units and modules is illustrated, and in practical application, the above-described functional distribution may be performed by different functional units and modules according to needs, i.e. the internal structure of the apparatus is divided into different functional units or modules to perform all or part of the above-described functions.
The above embodiments are only for illustrating the technical solution of the present invention, and not for limiting the same; although the invention has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical scheme described in the foregoing embodiments can be modified or some technical features thereof can be replaced by equivalents; such modifications and substitutions do not depart from the spirit and scope of the technical solutions of the embodiments of the present invention, and are intended to be included in the scope of the present invention.

Claims (7)

1. A method for processing a page form, the method comprising:
if the operation that the user submits through the browser page touch form is detected, version information of the browser is obtained;
If the version information meets the preset version compatibility requirement, acquiring a form control in the form to be submitted;
checking the control name of each form control according to the pre-stored change relation of the control name before and after dynamic setting in each browser version in a preset control data table, if the control name of the form control is the control name after dynamic setting, taking the form control as a control to be processed, taking the control name after dynamic setting as a target control name, and taking the control name of the target control name before dynamic setting as a source control name;
replacing the attribute definition of the target control name in the to-be-processed control with the attribute definition of the source control name to obtain the updated to-be-submitted form;
analyzing the updated form to be submitted, and sending the form data obtained by analysis to a server;
replacing the attribute definition of the target control name in the to-be-processed control with the attribute definition of the source control name, and obtaining the updated to-be-submitted form comprises:
acquiring an attribute value of the target control name in the control to be processed, and deleting attribute definition of the target control name;
Newly adding attribute definition of a preset basic control name in the control to be processed, and assigning an attribute value of the target control name to the basic control name;
replacing the basic control name in the control to be processed with the source control name;
the version information comprises a browser type and a browser version number, and the obtaining the version information of the browser comprises the following steps:
acquiring a user agent character string of the browser;
extracting the browser type and the browser version number from the user agent character string according to the information structure preset by the user agent character string;
if the version information meets the preset version compatibility requirement, the step of acquiring the form control in the form to be submitted comprises the following steps:
and if the browser type belongs to a preset target browser and the browser version number is smaller than a preset version number threshold, acquiring a form control in the form to be submitted.
2. The method for processing a page form according to claim 1, wherein the parsing the updated form to be submitted and transmitting the form data obtained by parsing to a server comprises:
According to preset verification conditions, verifying the validity of the updated contents of the form to be submitted;
if the validity verification is passed, acquiring the receiving address information of the server from the updated form label of the form to be submitted, and analyzing the content of each form control according to the type of each form control in the updated form to be submitted to obtain the control content corresponding to each form control;
and forming the control content corresponding to each form control into the form data, and transmitting the form data to the position corresponding to the receiving address information.
3. A page form handling device for implementing the page form handling method of any one of claims 1 to 2, the page form handling device comprising:
the version acquisition module is used for acquiring version information of the browser if detecting the operation submitted by the user through the page touch form of the browser;
the control acquisition module is used for acquiring a form control in a form to be submitted if the version information meets the preset version compatibility requirement;
The checking module is used for checking the control name of each form control according to the pre-stored change relation of the control name in each browser version before and after dynamic setting in a preset control data table, if the control name of the form control is the control name after dynamic setting, the form control is used as a control to be processed, the control name after dynamic setting is used as a target control name, and the control name of the target control name before dynamic setting is used as a source control name;
the updating module is used for replacing the attribute definition of the target control name in the control to be processed with the attribute definition of the source control name to obtain the updated form to be submitted;
and the analysis module is used for analyzing the updated form to be submitted and transmitting the form data obtained by analysis to a server.
4. The page form processing device of claim 3, wherein the update module comprises:
the deleting sub-module is used for acquiring the attribute value of the target control name in the control to be processed and deleting the attribute definition of the target control name;
The new adding sub-module is used for newly adding attribute definition of a preset basic control name in the control to be processed and assigning an attribute value of the target control name to the basic control name;
and the replacing sub-module is used for replacing the basic control name in the control to be processed with the source control name.
5. The page form processing device of claim 3, wherein the version information comprises a browser type and a browser version number, the version acquisition module comprising:
a user agent acquisition sub-module for acquiring a user agent character string of the browser;
and the extraction submodule is used for extracting the browser type and the browser version number from the user agent character string according to the information structure preset by the user agent character string.
6. A computer device comprising a memory, a processor and a computer program stored in the memory and executable on the processor, characterized in that the processor implements the steps of the page form handling method according to any of claims 1 to 2 when the computer program is executed.
7. A computer readable storage medium storing a computer program, characterized in that the computer program when executed by a processor implements the steps of the page form processing method according to any one of claims 1 to 2.
CN201811339106.9A 2018-11-12 2018-11-12 Page form processing method and device, computer equipment and storage medium Active CN109657178B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201811339106.9A CN109657178B (en) 2018-11-12 2018-11-12 Page form processing method and device, computer equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201811339106.9A CN109657178B (en) 2018-11-12 2018-11-12 Page form processing method and device, computer equipment and storage medium

Publications (2)

Publication Number Publication Date
CN109657178A CN109657178A (en) 2019-04-19
CN109657178B true CN109657178B (en) 2024-03-01

Family

ID=66110838

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201811339106.9A Active CN109657178B (en) 2018-11-12 2018-11-12 Page form processing method and device, computer equipment and storage medium

Country Status (1)

Country Link
CN (1) CN109657178B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112766910B (en) * 2021-01-21 2023-10-27 深圳市极致科技股份有限公司 Document construction method, generation method, device, electronic equipment and storage medium

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103997492A (en) * 2014-05-20 2014-08-20 五八同城信息技术有限公司 Adaption system and method
WO2015022701A2 (en) * 2013-08-12 2015-02-19 Ciphergraph Networks Private Limited Method and system of routing and handover of secure communication without knowledge of private/secret key
WO2016131311A1 (en) * 2015-07-16 2016-08-25 中兴通讯股份有限公司 Browser compatibility method and browser
CN106888247A (en) * 2016-12-26 2017-06-23 沈阳通用软件有限公司 A kind of unified terminal IE configurations and the method for protection

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2015022701A2 (en) * 2013-08-12 2015-02-19 Ciphergraph Networks Private Limited Method and system of routing and handover of secure communication without knowledge of private/secret key
CN103997492A (en) * 2014-05-20 2014-08-20 五八同城信息技术有限公司 Adaption system and method
WO2016131311A1 (en) * 2015-07-16 2016-08-25 中兴通讯股份有限公司 Browser compatibility method and browser
CN106354484A (en) * 2015-07-16 2017-01-25 中兴通讯股份有限公司 Browser compatibility method and browser
CN106888247A (en) * 2016-12-26 2017-06-23 沈阳通用软件有限公司 A kind of unified terminal IE configurations and the method for protection

Also Published As

Publication number Publication date
CN109657178A (en) 2019-04-19

Similar Documents

Publication Publication Date Title
US11563674B2 (en) Content based routing method and apparatus
US9444899B2 (en) Use of internet information services logging to collect user information in an asynchronous manner
CN109471988B (en) Page information updating method and device, computer equipment and storage medium
CN108804159B (en) Javascript module loading method and preprocessing method and device thereof, and computer equipment
CN108897788B (en) Data crawling method and device, computer equipment and storage medium
CN108038134B (en) Page display method and device, storage medium and electronic equipment
CN111563051B (en) Crawler-based data verification method and device, computer equipment and storage medium
CN112073405A (en) Webpage data loading method and device, computer equipment and storage medium
CN108268635B (en) Method and apparatus for acquiring data
CN108959384B (en) Webpage data acquisition method and device, computer equipment and storage medium
CN113382083B (en) Webpage screenshot method and device
CN111431767B (en) Multi-browser resource synchronization method and device, computer equipment and storage medium
CN112637361A (en) Page proxy method, device, electronic equipment and storage medium
CN109657178B (en) Page form processing method and device, computer equipment and storage medium
US10095791B2 (en) Information search method and apparatus
CN111782244A (en) Configuration file updating method and device, computer equipment and storage medium
JP5535184B2 (en) Browser execution script conversion system and browser execution script conversion program
CN110460685B (en) User unique identifier processing method and device, computer equipment and storage medium
CN107918552B (en) Light application calling method and device, client device and electronic equipment
CN110633432A (en) Method, device, terminal equipment and medium for acquiring data
CN111381786B (en) Text printing method and device, computer equipment and storage medium
CN113934954A (en) Webpage first screen rendering method and device in application program
CN112948727B (en) WebView-based data injection method, device, equipment and storage medium
CN110618934A (en) Front-end automatic test debugging method and device and computer readable storage medium
CN104679786A (en) Form processing method and device

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant