The invention discloses a method and a system for automatically filling forms. The method and system can achieve the following functions: to support the common web form element assignment; automatic trigger form change event form after the assignment, and flexible configuration; only on a sub element element assignment, assignment module; the date and amount of the custom format support; support multilevel linkage drop-down box value select and assign. Therefore, the embodiment of automatic filling method provided form, can greatly improve the editing and details page initialization part of the web development tedious, developers only need a simple configuration can be completed in the past need to write a lot of code operation. And in the case of not writing JS code can be convenient for a variety of elements assigned, easy to maintain and expand.
【技术实现步骤摘要】
本专利技术涉及页面数据处理
,尤其涉及一种表单自动填充方法和系统。
技术介绍
在日常工作和生活中,经常会遇到反复填写信息相同的网络表单的情况,为了解决反复填写相同信息带来的麻烦,目前,可以通过设置FormFill插件,使用Json串给表单赋值的方法,实现表单自动填充。但是,这种表单自动填充技术无法配置多级下拉框联动,也无法配置时间和金额等的格式化,不能指定赋值元素范围等,导致可以自动填充的信息受到极大的限制,使得用户的体验度差。
技术实现思路
本专利技术的目的在于提供一种表单自动填充方法和系统,从而解决现有技术中存在的前述问题。为了实现上述目的,本专利技术采用的技术方案如下:一种表单自动填充方法,包括如下步骤:S1,编写表单结构,手动给表单添加data-fill属性,并设置data-fill属性值为所述表单在Json字符串中对应的字段值;其中,所述表单包括input元素;S2,调用赋值方法:inputfill.Init(\模块编号\,\Json数据\),对所述表单的Json字符串进行解析,获取所有包含data-fill属性的元素,并将data-fill属性值填充在所述表单的data-fill属性中。优选地,S2之后还包括步骤:触发所述表单的change事件。优选地,还包括步骤:对表单添加属性data-type,设置表单为日期或金额,并指定方法:varinputfill=newInputFill(formatDate=\mm-dd-yy\,normalCent=2)。优选地,还包括步骤:在所述表单的下拉框元素中添加data-paramid属性,并设置da ...
【技术保护点】
一种表单自动填充方法,其特征在于,包括如下步骤:S1,编写表单结构,手动给表单添加data‑fill属性,并设置data‑fill属性值为所述表单在Json字符串中对应的字段值;其中,所述表单包括input元素;S2,调用赋值方法:inputfill.Init(模块编号,Json数据),对所述表单的Json字符串进行解析,获取所有包含data‑fill属性的元素,并将data‑fill属性值填充在所述表单的data‑fill属性中。
【技术特征摘要】
1.一种表单自动填充方法,其特征在于,包括如下步骤:S1,编写表单结构,手动给表单添加data-fill属性,并设置data-fill属性值为所述表单在Json字符串中对应的字段值;其中,所述表单包括input元素;S2,调用赋值方法:inputfill.Init(\模块编号\,\Json数据\),对所述表单的Json字符串进行解析,获取所有包含data-fill属性的元素,并将data-fill属性值填充在所述表单的data-fill属性中。2.根据权利要求1所述的表单自动填充方法,其特征在于,S2之后还包括步骤:触发所述表单的change事件。3.根据权利要求1所述的表单自动填充方法,其特征在于,还包括步骤:对表单添加属性data-type,设置表单为日期或金额,并指定方法:varinputfill=newInputFill(formatDate=\mm-dd-yy\,normalCent=2)。4.根据权利要求1所述的表单自动填充方法,其特征在于,还包括步骤:在所述表单的下拉框元素中添加data-paramid属性,并设置data-paramid属性值为父级表单的data-fill属性值;在所述表单的data-url属性中设置下拉框的取值地址为父级表单,若所述父级表单发生变动,则触发Change事件。5.根据权利要求1...
【专利技术属性】
技术研发人员:宋长烁,
申请(专利权)人:车智互联北京科技有限公司,
类型:发明
国别省市:北京;11