Skip to Content
0

How do i restrict the user input in ComboBox to only model data in SAPUI5?

Mar 24, 2017 at 04:09 AM

351

avatar image
Former Member

I have a scenario where i want to restrict user to only input text that is only loaded to the combobox as seen in this MultiComboBox example. [Take note that this is not my jsbin. please post your answer in this thread]

http://jsbin.com/sicixisozi/edit?html,js,output

in the above example, user is only allowed to enter characters that are present in the combobox, for example entering a 's' will prompt invalid entry and prevent user from typing. however i do not need the multi select as i only allow one selection.

this function is not found in default SAPUI5 combobox

http://jsbin.com/xenidoh/embed?html,output

as seen in above example, user are not restricted and are able to input anything to the combobox.

any suggestion how i could implement the feature above?

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

4 Answers

Jun Wu Mar 24, 2017 at 12:33 PM
1
Show 1 Share
10 |10000 characters needed characters left characters exceeded
Former Member

dropdown would be the right control

0
Mahesh kumar palavalli Mar 30, 2017 at 05:36 AM
-1

you could simply use the change event and check the binded model data if the user is entering the correct value or not.

Best Regards,
Mahesh

Share
10 |10000 characters needed characters left characters exceeded
Akhilesh Upadhyay Mar 24, 2017 at 08:51 AM
0

not sure about any inbuilt functionality for that, but you can try below.

you can attach browser event for "keyup", check this Example may help you.

Share
10 |10000 characters needed characters left characters exceeded
avatar image
Former Member Mar 26 at 09:46 AM
0

Hi,

>> In combobox manual option is given for suggestions. If user entered a text which does not match DD value, the key will be set to "" (empty).

>> We can validate this key and value in change event of combobox.

>> In Multicombo we have option to select multiple and the selected values are converting into Tokens "value (key)", this is the reason why it is not allowing to enter wrong values. But for Combobox we have to put a manual validation.

Regards,

Gururaj

Share
10 |10000 characters needed characters left characters exceeded