如何更改输入类型 = 'file' 和 xtype='textfield' 的按钮'Browse'名称



我们正面临一个奇怪的问题,我们无法改变按钮名称从'浏览'与文件上传字段。

我们非常需要这个特性来支持多种语言。我们使用xtype:textfield和输入类型为'file'

请帮忙解决这个问题。我们正在使用EXTJS 3.4

xtype:'textfield'
input type : 'file'

有一个很好的扩展,你可以使用它。

文件上传字段示例

FileUploadField.jsfileuploadield.css

jsFiddle例子

Ext.onReady(function () {

    new Ext.Viewport({

        layout: 'fit',
        items: [
            {
                xtype: 'form',
                items: [
                    {
                        xtype: 'textfield',
                        fieldLabel: 'Textfield with inputType=file',
                        inputType: 'file'
                    },
                    {
                        xtype: 'fileuploadfield',
                        width: 200,
                        emptyText: 'Select a file',
                        fieldLabel: 'FileUploadField UX',
                        name: 'blah-blah',
                        buttonText: 'Custom Text'
                    }
                ],
                title: 'Form'
            }
        ]
    });
});

<html>
<head>
</head>
<body>
<form>
<input type=text name=file style="width:60px"> 
<input type=file name=newfile style="display:none">
<input type=button onClick="newfile.click();file.value=newfile.value; " value="import from excel">
</form>
</body>
</html>

最新更新