Dojo textBox不接受空格 [英] Dojo textBox doesn't accept whitespace
问题描述
我在Dojo项目中没有经验,不知道我在做什么版本。
I'm working with no experience on a Dojo project and don't know which version I'm working on.
对于不接受空格的搜索表单,有一个textBox。我在本文档中搜索了一个解决方案,但没有方法似乎不适用。 http://dojotoolkit.org/api/dijit/form/TextBox
There is a textBox for a search form which doesn't accept whitespace. I searched in this documentation for a solution, but no method seems to be applicable. http://dojotoolkit.org/api/dijit/form/TextBox
所以我的问题是:是否可以接受一个textBox窗体中的空格,或者只是可能使用ValidationTextBox?
So my question is: is it possible to accept whitespace in a textBox form or is it just possible with a ValidationTextBox?
me.filterBox = new TextBox({
style: 'margin-bottom: 0',
class: 'STQuicksearch',
trim: false,
intermediateChanges: true,
placeHolder: 'Quick search'
});
编辑:
设置trim false或true之间没有区别。但这不是我的问题:我需要将空格放在多个单词之间。修剪只删除前导和尾随空格!
There is no difference between setting trim false or true. But that's not my problem: I need to put whitespace between multiple words. Trim only removes leading and trailing whitespace!
推荐答案
编码工作解决方案:
me.filterBox = new TextBox({
...
onKeyDown: function(e) {
if (e.keyCode === keys.SPACE) {
this.set('value', this.get('value')+' ');
}
}
});
这篇关于Dojo textBox不接受空格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!