Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/80.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何使用javascript/jQuery生成动态表单?_Javascript_Jquery_Dynamic_Form Generator - Fatal编程技术网

如何使用javascript/jQuery生成动态表单?

如何使用javascript/jQuery生成动态表单?,javascript,jquery,dynamic,form-generator,Javascript,Jquery,Dynamic,Form Generator,我需要根据服务器的Ajax响应动态生成整个html表单。作为响应,将有输入类型、输入标签、验证(如果有)等信息 表单最多只能有十个字段 是否有任何jQuery/javascript工具/插件来生成表单 谢谢 从他们的例子来看: value = {"key":"value"} "key" will be the value attribute and "value" will be the shown value of the element. If the array is constr

我需要根据服务器的Ajax响应动态生成整个html表单。作为响应,将有输入类型、输入标签、验证(如果有)等信息

表单最多只能有十个字段

是否有任何jQuery/javascript工具/插件来生成表单

谢谢

从他们的例子来看:

    value = {"key":"value"} "key" will be the value attribute and "value" will be the shown value of the element. If the array is constructed like {"value",value","value"} (without keys) then the value attribute of the input will be an auto-incremented number starting from 0.
options = {} See options table below.

$.fn.formation(options); [Create a form]
$.formation.addInput(options); [Append an input]
$.formation.addSelect(values,options); [Append a select]
$.formation.addTextarea(options); [Append a textarea]
$.formation.addCheckboxes(values,options); [Append an unordered list of checkboxes]
$.formation.addRadios(values,options); [Append an unordered list of radio buttons]
$.formation.addCaptcha(options); [Adds a captcha question to your form]
$.formation.addButton(options); [Append a button]
$.formation.setErrorMessages(options); [Set custom error messages for validation]

然而,这些都是使用Jquery可以轻松完成的,这是一种很好的学习体验,因此我建议您自己尝试一下。

很简单,为什么不尝试一下呢yourself@AmGates. 嗨,我知道这很简单,但我只是想知道是否有任何工具或插件可以加快开发。我的意思是为什么要重新发明轮子-它需要一个迭代器,假设Ajax响应中包含了您需要的所有内容。没有任何合理的方法可以让插件更快,迭代器就是工具!我和阿姆盖兹在一起;试试看@格雷格·佩蒂特。可以让我试试-