本文介绍了添加accept =“image / *”属性到ExtJ中的输入字段的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想使用HTML5accept属性和ExtJsinputAttrTplconfig添加客户端验证文件上传。
我的ExtJs代码如下(ExtJs 4.1):
{
/ pre>
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设置为 删除限制。
I want to add client side validation for file upload using HTML5 "accept" attribute and ExtJs "inputAttrTpl" config.My ExtJs code is following (ExtJs 4.1):
{ xtype : 'filefield', action : 'upload', name : 'file', inputAttrTpl: 'accept="image/*"', hideLabel : true, buttonOnly : true, anchor : '100%', buttonText : 'Upload img...', margin: 5 }
But when I am checking file field in firebug, it doesn't contain "accept" attribute.Can you suggest some solutions for this issue?Thanks for your replies.
解决方案{ xtype:'filefield', listeners:{ afterrender:function(cmp){ cmp.fileInputEl.set({ accept:'audio/*' }); } } }
You can set accept to "" to remove the restriction.
这篇关于添加accept =“image / *”属性到ExtJ中的输入字段的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!