PDA

View Full Version : [CLOSED] TagField and Default button in FormField



sbg
Feb 04, 2014, 10:08 AM
Hello, I have TagField in a FormPanel having a Default button:


<ext:FormPanel runat="server">
<Items>
<ext:TextField ID="txtNome" Name="Nome" runat="server" FieldLabel="Nome" AnchorHorizontal="100%" />

<ext:TagField runat="server" ID="tagSinonimi" Name="Sinonimi" TypeAhead="True" AnchorHorizontal="100%" AllowBlank="True"
CreateNewOnEnter="True"
CreateNewOnBlur="True" FieldLabel="Sinonimi" Note="INVIO per aggiungere un sinonimo">
</ext:TagField>

<!-- Other items -->
</Items>
<Buttons><ext:Button Text="Ok" OnClientClick="alert('ok');" /> </Buttons>
</ext:FormPanel>
Both in Chrome and in IE 11, sometimes it works: Writing something and pressing ENTER will result the TagField to show the new tag.
But very often the default button's trigger is launched and the tag is not created in the tagfield

Daniil
Feb 04, 2014, 11:16 AM
Hi @sbg,

Thank you for the report.

Please try this:

Ext.net.TagField.override({
onKeyDown: function(e, t) {
var me = this,
key = e.getKey(),
rawValue = me.inputEl.dom.value,
pos = this.getCursorPosition(),
stopEvent = false;

if (me.readOnly || me.disabled || !me.editable) {
return;
}

if (me.isExpanded && (key == e.A && e.ctrlKey)) {
me.select(me.getStore().getRange());
me.collapse();
me.inputEl.focus();
stopEvent = true;
}

if (stopEvent) {
me.preventKeyUpEvent = stopEvent;
e.stopEvent();
return;
}

if (key == e.ENTER) {
e.stopEvent();
//e.preventDefault();
}
else if (key == e.LEFT) {
if (pos == 0 && this.inputMoving) {
this.tagLabel.moveInput(-1, pos);
this.focus();
this.selectText(0, 0);
}
}
else if (key == e.RIGHT) {
if (pos == rawValue.length && this.inputMoving) {
this.tagLabel.moveInput(1, pos);
this.focus();
this.selectText(pos, pos);
}
}

if (me.isExpanded && (key == e.ENTER) && me.picker.highlightedItem) {
me.preventKeyUpEvent = true;
}

if (me.enableKeyEvents) {
me.callParent(arguments);
}
}
});

Daniil
Feb 05, 2014, 3:34 AM
It has been fixed in the SVN trunk, revision #5653. It will go to the v2.5 release.

Thank you again for the report.