PDA

View Full Version : [CLOSED] Prevent User Entry for ComboBox, but maintain LocalQuery



rthiney
Oct 15, 2013, 3:22 PM
Hi ,
I have a ComboBox defined as such:


<ext:ComboBox runat="server" ID="cmboIndSector" TypeAhead="true" FieldLabel="Industry" ForceSelection="true" QueryMode="Local" SelectOnFocus="true" MinChars="1" AnchorHorizontal="95%" >
<ListConfig MinWidth="300" />
</ext:ComboBox>


I want the user to be able to typeahead to quickly find entries, but I don't want them to enter something that doesn't exist and have that be submitted...
Is there a setting for this, or do I have to do something more complicated?

Daniil
Oct 15, 2013, 5:29 PM
Hi @rthiney,

Please clarify how do you submit a ComboBox? ForceSelection="true" should clear the field on blur if the entered text doesn't match any item.

michaeld
Oct 16, 2013, 12:15 AM
Yes, this too has been a frustration for me as well. I don't want editable but I want query. ForceSelection doesn't do the job. And SelectBox only allows single key lookup. There's no in-between.

rthiney
Oct 16, 2013, 12:42 AM
Hi @rthiney,

Please clarify how do you submit a ComboBox? ForceSelection="true" should clear the field on blur if the entered text doesn't match any item.


Alas, it does not. Let me be more precise...if I click anywhere else on the form to lose focus, yes, it does clear it out. But if the users click immediately on the submit button, the typed in text gets passed along, at least when the submit button does a App.direct.Submit() Ajax style post back and I obtain the value of the combo box using #{cmboStuff}.getValue()...

Baidaly
Oct 16, 2013, 1:08 AM
Hello!

Probably, a small delay for the Click handler can solve your problem.

rthiney
Oct 16, 2013, 1:22 AM
Hello!

Probably, a small delay for the Click handler can solve your problem.


ok, I think I know why, here is 1 more wrench..

The form is in a child page, loaded in a window. The submit buttons are in the window (ie, parent of the form)... any suggestions?

Baidaly
Oct 16, 2013, 2:27 AM
OK, that explains why ForceSelection doesn't work in your case. I think it'd be better to change the logic or load FormPanel in Html mode.

However, easier can be to call beforeBlur method before calling of DirectEvent.

rthiney
Oct 16, 2013, 2:55 AM
OK, that explains why ForceSelection doesn't work in your case. I think it'd be better to change the logic or load FormPanel in Html mode.

However, easier can be to call beforeBlur method before calling of DirectEvent.

How would that work? The beforeBlur listenter for the button in the window? What command would I issue?

Daniil
Oct 16, 2013, 5:20 AM
@Baidaly suggested the following:

<Click OnEvent="Submit" Before="containerWithIframe.getBody().App.ComboBox1.trigge rBlur();">

Though, calling the triggerBlur instead of the beforeBlur might be better.

Please note that a parent page and its child (iframe) page are isolated. Clicking on the parent page doesn't blur anything in the child page.


Yes, this too has been a frustration for me as well. I don't want editable but I want query. ForceSelection doesn't do the job.

Well, ForceSelection works on blur only. I am not sure I understand your request. Could you, please, elaborate?


And SelectBox only allows single key lookup. There's no in-between.

Yes, it works the same as an HTML <select> works.