ExtJS 4.1
I have 2 textfields like:
{
fieldLabel: 'Email',
name: 'email',
vtype: 'email',
}, {
fieldLabel: 'Phone',
name: 'phone',
minLength: 8,
maxLength: 20,
value: '+7',
},
As you can see phone
field has predefined value.
When I finish filling email
fileld, I press TAB key to focus next field (in my case - phone
field).
When phone
field is being focused by TAB key cursor incfield stands in the end of value (+7|
) but all the text in the field becomes selected so if I type something all the text is replaced by new text.
I want cursor to stand in the end of the value string and value text would NOT TO BE SELECED.
Here's a workaround that works:
{
fieldLabel: 'Phone',
name: 'phone',
minLength: 8,
maxLength: 20,
value: '+7',
listeners: {
focus: function(field){
var value = field.getValue();
Ext.Function.defer(field.setRawValue, 1, field, [value]);
}
}
}
Causes a page reflow that sets the caret at the end of the field due to the value being set, should work for ya and doesn't cause a change event.