【问题标题】:ExtJS, IE7 form submission problemExtJS、IE7表单提交问题
【发布时间】:2011-06-28 14:33:35
【问题描述】:

我有一个使用'form' xtype 定义的ExtJS 表单面板。当用户单击提交时,此表单的 url 会根据他们所在的页面而更改。这是一个文件上传表单。在 IE7 中,url 参数被完全忽略,返回的字符串是来自网站根目录的 HTML。在 IE8、FF 和 Chrome 中,这完全可以正常工作。

是否有某种安全设置或其他我应该寻找的东西? URL 参数似乎被完全忽略,导致文件上传失败。

表单代码(表单在窗口中):

items: [{
            xtype: 'form',
            fileUpload: true,
            baseCls: 'x-window',
            bodyStyle: 'font-family:tahoma;font-size:12px;',
            defaults: {
                bodyStyle: 'font-family:tahoma;font-size:12px;',
                width: 200
            },              
            items: [{
                xtype: 'hidden',
                name: 'action',
                value: 'import'
            }, {
                xtype: 'fileuploadfield',
                fieldLabel: 'Import File',
                name: 'uit'
            }]
        }],
        fbar: [{
            text: 'Import',
            handler: this.handleImportFn,
            scope: this
        }, {
            text: 'Cancel',
            handler: function () {
                var myB = this;
                myB.disable();
                this.ownerCt.ownerCt.hide();
                myB.enable();
            }
        }]

表单提交:

            form.submit({
            params: {
                id: id
            },
            url: this.superParent.myBasicURL // This has been verified valid,
            waitMsg: 'Uploading file',
            success: function (form, action) {
                var resp = Ext.decode(action.response.responseText),
                    addSucc = resp.addSucc || false,
                    msg = 'Import completed successfully.';

                if (addSucc) {
                    if (typeof resp.skipped !== 'undefined' && resp.skipped > 0) {
                        msg += "  " + resp.skipped + " records skipped [" + resp.skips + "].";
                    }
                    Ext.MessageBox.alert("Info", msg);
                    myStore.load();
                    myWin.hide();
                }
                else {
                    Ext.MessageBox.alert("Error", resp.error);
                }
            },
            failure: function (form, action) {                  
                switch (action.failureType) {
                    case Ext.form.Action.CLIENT_INVALID:
                        Ext.Msg.alert('Failure', 'Form fields may not be submitted with invalid values');
                        break;
                    case Ext.form.Action.CONNECT_FAILURE:
                        Ext.Msg.alert('Failure', 'Ajax communication failed');
                        break;
                    case Ext.form.Action.SERVER_INVALID:
                        Ext.Msg.alert('Failure', action.result.error);
                        break;
                }
            }
        });

谢谢...

【问题讨论】:

  • 可以添加一些HTML表单的源代码吗?仅根据您的问题很难判断问题出在哪里。

标签: javascript extjs internet-explorer-7


【解决方案1】:

我发现 IE7 表单有一个非常奇怪的行为。在我的情况下,它“可能”是 Dojo 的问题,但它与 IE7 的症状相同。我懒得用标准表格验证。

如果我有一个名为 action 的隐藏字段,IE7 将完全忽略表单 action 参数并将表单发布到当前页面。从本质上讲,它的行为就像未指定操作一样。

现在我发现这个问题可以解决,但看到它在 IE8 和其他系统中有效,IE7 代码中关于 action 参数的内容必须有所不同。

【讨论】:

    猜你喜欢
    • 2012-10-22
    • 2011-12-24
    • 2012-08-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-02-02
    • 2010-10-09
    • 1970-01-01
    相关资源
    最近更新 更多