Looking for breakthrough ideas for innovation challenges? Try Patsnap Eureka!

Event extension method of Form based on JavaScript

An extension method and event technology, applied in the computer field, can solve the problems of low code quality and complicated operation, and achieve the effect of improving work efficiency and reducing workload

Inactive Publication Date: 2019-12-20
CHENGDU DBAPP SECURITY
View PDF6 Cites 2 Cited by
  • Summary
  • Abstract
  • Description
  • Claims
  • Application Information

AI Technical Summary

Problems solved by technology

To dynamically change the styles and values ​​of these Form elements according to conditions, when registering events and triggering events, the operations are often complicated, which will cause developers to do many of the same operations, and the code quality is not high

Method used

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
View more

Image

Smart Image Click on the blue labels to locate them in the text.
Viewing Examples
Smart Image
  • Event extension method of Form based on JavaScript
  • Event extension method of Form based on JavaScript
  • Event extension method of Form based on JavaScript

Examples

Experimental program
Comparison scheme
Effect test

Embodiment 1

[0088] A kind of event extension method of the Form form based on Javascript of this embodiment, as figure 1 As shown, it is achieved through the following steps:

[0089] Step 1. Determine the event type of the Form form and register it on the HTML tag element;

[0090] Step 2, define a base object A for binding events, the base object A includes a change event registration of a general Form form element suitable for different selectors, and the dynamic assignment change of the change event specifically corresponding to the value of the current form element;

[0091] Step 3, define a method B that encapsulates form events. This method is instantiated as a variable based on the base object A, so that in the method of encapsulating the form, the change event registered in the base object A is triggered according to the event flow to dynamically change the form value. Methods;

[0092] Step 4, when the page js file is called, instantiate form event function C according to met...

Embodiment 2

[0096] This embodiment is further optimized on the basis of embodiment 1, and the second step specifically includes two steps of defining a function and registering a message event:

[0097] In the step of defining the function described above, the parameter object_id must first be passed to define the form selector type, and the element attribute name data_attr is constructed, and the change event and errror event based on object_id are registered. When the element triggers the change event, a message is manually triggered Event, pass in the value of the parameter data_attr (attribute name) and the value entered by the user of the current element (so that it can be used to assign values ​​to the element when the message event is triggered);

[0098] The registered massage event is triggered by the callback function of the change event registered in the document stream using the trigger() method; the specific process of registering the massage event is as follows: use the on() ...

Embodiment 3

[0101] This embodiment is further optimized on the basis of the above-mentioned embodiment 1 or 2. In the step of registering a massage event, if it is a checkbox, it needs to determine whether the style is selected according to its current value. If the value is 1, then change the style of the checkbox to the selected state, and change its value to 0 to prepare for the next click change, if it is 0, cancel the check, and change its value to 1 at the same time.

[0102] Other parts of this embodiment are the same as those of Embodiment 1 or 2 above, so details are not repeated here.

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
Login to View More

PUM

No PUM Login to View More

Abstract

The invention discloses an event extension method of a Form based on Javascript. According to the invention, the event type of the Form is determined; registration is carried out on html; a basic object A bound with a Form event is defined; a method B for packaging the Form event is defined; the method B is instantiated into a variable on the basis of a basic object A, so that in a form packagingmethod, a change event registered in the basic object A is triggered according to an event flow to dynamically change a form value; and finally, when a js file is called, a calling object C is instantiated according to the method B, and the type is transmitted. At the moment, registration and definition of the Form event are completed, in one Form event, before interaction between a submitted formand a background is achieved, the Form event is applied, the interaction efficiency can be improved, a user does not need to be reminded to modify input after the background returns error information, and meanwhile the page effect can be changed according to data returned by the background.

Description

technical field [0001] The invention relates to the technical field of computers, in particular, an event extension method of a Javascript-based Form. Background technique [0002] The form is mainly responsible for the data collection function in the web page. A form has three basic components: [0003] 1. Form label: This contains the URL of the CGI program used to process the form data and the method for submitting the data to the server; [0004] Function: used to declare the form and define the scope of data collection, that is <form>and< / form> The data contained in it will be submitted to the server or email. [0005] 2. Form fields: including text boxes, password boxes, hidden fields, multi-line text boxes, check boxes, radio boxes, drop-down selection boxes and file upload boxes, among which: [0006] A text box is a form object that allows visitors to enter their own content, usually used to fill in a single word or a short answer, such as name, addr...

Claims

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
Login to View More

Application Information

Patent Timeline
no application Login to View More
Patent Type & Authority Applications(China)
IPC IPC(8): G06F16/958
CPCG06F16/972G06F16/986
Inventor 刘佳范渊吴永越郑学新刘韬
Owner CHENGDU DBAPP SECURITY
Who we serve
  • R&D Engineer
  • R&D Manager
  • IP Professional
Why Patsnap Eureka
  • Industry Leading Data Capabilities
  • Powerful AI technology
  • Patent DNA Extraction
Social media
Patsnap Eureka Blog
Learn More
PatSnap group products