我想使用 HTML5“accept”属性和 ExtJs“inputAttrTpl”配置为文件上传添加客户端验证。 我的 ExtJs 代码如下(ExtJs 4.1):
{
xtype : 'filefield',
action : 'upload',
name : 'file',
inputAttrTpl: 'accept="image/*"',
hideLabel : true,
buttonOnly : true,
anchor : '100%',
buttonText : 'Upload img...',
margin: 5
}
但是当我在 firebug 中检查文件字段时,它不包含“accept”属性。 你能为这个问题提出一些解决方案吗? 感谢您的回复。
最佳答案
{
xtype:'filefield',
listeners:{
afterrender:function(cmp){
cmp.fileInputEl.set({
accept:'audio/*'
});
}
}
}
您可以将 accept 设置为 ""以取消限制。
关于javascript - 将 accept ="image/*"属性添加到 ExtJs 中的输入字段,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14317777/