日期:2014-05-16  浏览次数:20604 次

jquery.form.js插件页面2个表单提交一个表单后台action对象属性收不到值为null
HTML code

<form id="fileForm">
<!--上传文件begin--> 
<input type="hidden" id="fileName" name="file.filename" />
<input type="hidden" id="name" name="file.name" />
<input type="hidden" id="size" name="file.size"/>
<div id="divtcy2" style="display: none;">
<div class="zuzhuav4">
<div class="centtop">UpLoad</div>
<div class="zuzhuangone"><span class="sp1">路径:</span> <span class="sp2"> <input id="upload" name="upload" type="file" onchange="fileUpload()" /> </span></div>
<div class="h10"></div>
<div class="zuzhuangone" style="text-align: center;">
<input id="buttonUpload" type="button" class="delcssbtncss" onclick="addFile()" value="确定" />&nbsp;&nbsp; 
<input type="button" class="delcssbtncss" value="取消" onclick="javascript:msgBox_close();"/></div>
<div class="h10"></div>
</div>
</div>
<!--上传文件end-->
</form>

<!--新文件夹begin-->
<form id="folderForm">
<div id="divtcy1" style="display: none;">
<div class="zuzhuavh">
<div class="centtop">AddFolder</div>
<div class="zuzhuangone"><span class="sp1">文件夹名:</span>
<span class="sp2"><input id="Text1" type="text" name="folder.name" class="cssinsear" value=""/></span>
</div>
<div class="zuzhuangone">
<span class="sp1">描述:</span>
<span class="sp2"><textarea cols="" rows="" class="textaronerfv" name="folder.remark"></textarea></span>
</div>

<div class="h10"></div>
<div class="zuzhuangone" style="text-align: center;">
<input name="" type="button" class="delcssbtncss" value="确定" onclick="addFolder();" />&nbsp;&nbsp; 
<input name="" type="button" class="delcssbtncss" value="取消" onclick="javascript:msgBox_close();"/></div>
<div class="h10"></div>
</div>
</div>
</form>
<!--新文件夹end-->


JScript code

//添加文件夹
    function addFolder() {
        var url = "${path}/resource/document!save.action";
        $("#folderForm").ajaxSubmit( {
            dataType : "json",
            type : "post",
            url : url,
            success : function(result) {
                if (result.code == "0") {
                    location.href = "${path}/resource/document!index.action";
                } else {
                    alert(result.msg);
                }
            }
        });
    }



---------------------------------------
我在jsp页面调用addFolder()方法请求到后台action,action的folder对象属性为null,收不到前台的值,我去掉第一个上传文件的form(<form id="fileForm"></form>),然后再次调用后台action就能收到值了,folder属性不为null了,这是我今天在做项目遇到的一个问题,今天搞了一个下午了,还没解决,我怀疑可能是这个插件可能不支持2个form,但是我今天在网上查资料没看到相关处理的方法,请高手帮我解决,非常非常感谢!!!在线等待。。。

------解决方案--------------------
弄成