刚刚在ASP.NET页面上实现了JQuery表单插件,这就是问题所在:
我有一个Form标签(继承自母版页)
表单插件完全取决于连接的“表单”字段
我试图将一个简单的“div”连接到ajaxSubmit但是它没有工作,因为formData通过form.elements循环,所以我必须传递页面的形式...
那么什么会节省一天并允许我使用表单插件是一种方法将上下文传递给插件,它选择输入表单我告诉它通过
主要原因是我有多个保存按钮(实际上没有一个是提交按钮,只是“保存”请求时出现的链接以保存部分表单)
var options = { url: 'template.aspx', type: 'POST', dataType: "html", data: { "iPageId": 1, "iModeId": "save"}, // here is where I want to pass all inputs success: function (responseText, statusText, xhr, $form) { // got responseText correctly }, beforeSubmit: function (formData, jqForm, options) { // I wish there is a way to tell the plugin not to look outside a specific set of the page } }; $myMainForm.ajaxSubmit(options);Just implemented the JQuery form plugin on an ASP.NET page, and here is the problem:
I have one Form tag (inherited from the master page)
Form plugin depends entirely on a "form" field being wired up
I tried to wire a simple "div" to the ajaxSubmit but it didnt work since formData looped thru form.elements, so I must pass the form of the page...
So what would save the day and allow me to use the form plugin is a way to pass a context to the plugin that it selects the input forms i tell it to pass
the major reason for that is that i have multiple save buttons (none of them is a submit button actually, just "save" links that appear on request to save part of the form)
var options = { url: 'template.aspx', type: 'POST', dataType: "html", data: { "iPageId": 1, "iModeId": "save"}, // here is where I want to pass all inputs success: function (responseText, statusText, xhr, $form) { // got responseText correctly }, beforeSubmit: function (formData, jqForm, options) { // I wish there is a way to tell the plugin not to look outside a specific set of the page } }; $myMainForm.ajaxSubmit(options);最满意答案
嗯,没有答案所以我会接受我的工作,我只是设置“sematic = true”来强制getElementsbyTagName而不是form.elements
PS,我通过在运行时通过jquery在我想要单独提交的元素周围注入表单标签来解决单个表单
hmm, no answers so i will accept my work around, I'll just set "sematic=true" to force a getElementsbyTagName instead of form.elements
PS, i worked around the single form by injecting form tags on runtime via jquery around the elements i want to submit individually
更多推荐
form,电脑培训,计算机培训,IT培训"/> <meta name="description" conten
发布评论