Skip to Content
avatar image
Former Member

ComboBox prevent user from typing

Hi,

I would like to know if it is possible to prevent the user to type in a ComboBox?

The user can only select one of the options. I want the same behavior as the sap.m.Select, where the user cannot type or "select empty".

Thanks, Cristiano.

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

3 Answers

  • Oct 15, 2015 at 09:14 PM

    You can fetch the jQuery instance of the input control used in the ComboBox and set the attribute readonly to true.

    oComboBox.addEventDelegate({
             onAfterRendering: function() {
                  oComboBox.$().find("input").attr("readonly", true);
             }
    });
    
    

    updated jsbin link - JS Bin - Collaborative JavaScript Debugging

    Add comment
    10|10000 characters needed characters exceeded

  • Oct 15, 2015 at 06:24 PM

    Hi,

    In compobox change these lines, oComboBox1.setEditable(true); to oComboBox1.setEditable(false);

    Add comment
    10|10000 characters needed characters exceeded

  • Oct 15, 2015 at 09:29 PM

    Hi,

    Taking cue from - @Sakthivel Elango here is the example - JS Bin - Collaborative JavaScript Debugging

    Sakthivel you link for jsbin does not have any code.

    Add comment
    10|10000 characters needed characters exceeded