formname.submit不能在IE8上运行

时间:2013-04-12 09:48:37

标签: php javascript jquery

我目前正在开发一款应用,我在IE8上遇到了困难。

我有以下代码:

<form class="fillClaimForm" name="fillClaimForm" method="POST" enctype="multipart/form-data" action="<?php print BASE_URL; ?>?action=insertBlogger" >
   <label for="fblogName">Blog's name: </label>
   <input type="text" name="fblogName" id="fblogName" class="cfInput" placeholder ="Complex" required />
   <label for="fblogUrl">URL: </label>
   <input type="text" name="fblogUrl" id="fblogUrl" class="cfInput" placeholder ="www.complex.com" required />
   <label>Blog's logo: </label>
   <div class="upload-file-container"><span>UPLOAD</span>
   <input  type="file" name="fblogLogo" id="fblogLogo"/>
   <p class="ErrLoad error" style="display:none;">Please load your logo</p>
   </div>
    <label for="fEmail">Email adresse: </label>
    <input  type="email" name="fEmail" id="fEmail" class="cfInput" required />
    <label for="frNum">Phone number: </label>
    <input  type="tel"  name="frNum" id="frNum" class="cfInput" required />
    <input type="hidden" name="idVid" id ="idVid" value=""/>
    <input type="hidden" name="idRubrique" id ="idRubrique" value=""/>
    <button id="sendClaim" class="sendClaim">SEND</button>

因此,我正在使用jquery进行表单提交:

......submit(function(){
        validate=false;
        formInfo = validateForm(validate,$thisLi);
        if(formInfo.validate){
            **fillClaimForm.submit();**
        }
        return false;
    });

它适用于除IE8之外的所有浏览器

有人可以帮助我。

由于

2 个答案:

答案 0 :(得分:1)

试试这个:

document.forms.fillClaimForm.submit();

或者,如果代码中的......表示在同一表单上创建提交处理程序,则可以只说this.submit()

答案 1 :(得分:1)

关闭表单。 同时使用与表单ID相同的名称并使用

$("#formId").submit();

代码

<form class="fillClaimForm" name="fillClaimForm" method="POST" enctype="multipart/form-data" action="<?php print BASE_URL; ?>?action=insertBlogger" >
   <label for="fblogName">Blog's name: </label>
   <input type="text" name="fblogName" id="fblogName" class="cfInput" placeholder ="Complex" required />
   <label for="fblogUrl">URL: </label>
   <input type="text" name="fblogUrl" id="fblogUrl" class="cfInput" placeholder ="www.complex.com" required />
   <label>Blog's logo: </label>
   <div class="upload-file-container"><span>UPLOAD</span>
   <input  type="file" name="fblogLogo" id="fblogLogo"/>
   <p class="ErrLoad error" style="display:none;">Please load your logo</p>
   </div>
    <label for="fEmail">Email adresse: </label>
    <input  type="email" name="fEmail" id="fEmail" class="cfInput" required />
    <label for="frNum">Phone number: </label>
    <input  type="tel"  name="frNum" id="frNum" class="cfInput" required />
    <input type="hidden" name="idVid" id ="idVid" value=""/>
    <input type="hidden" name="idRubrique" id ="idRubrique" value=""/>
    <button id="sendClaim" class="sendClaim">SEND</button>
</form>

$("#sendClaim").click(function(){
        validate=false;
        formInfo = validateForm(validate,$thisLi);
        if(formInfo.validate){
            $("#fillClaimForm").submit();
        }
        return false;
    });