Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    Simple question on ComboBoxItem

    Hello,

    In a dynamic form I'm using a ComboBoxItem, and also an option data source.
    Is it a way to specify that a user can't type a free text, but must use one of the option in the combobox?

    Thank you.

    Bertrand.

    #2
    Use SelectItem instead. There are several samples in the showcase.

    Comment


      #3
      Hi,

      In SelectItem, the type ahead functionality is different than the one in ComboBoxItem.

      In ComboBoxItem, if we type 'te', it will show the values that start with 'te' but in SelectItem, if we type 't', it will show the values that start with 't 'and whe we hit the 'e', it will go to the values that start with 'e'

      Is there a way to either disallow the user of entering a free text in comboboxitem as bgoetzmann asked or a way to make the type ahead of SelectItem the same as the one of ComboBoxItem?

      Thank you

      Comment


        #4
        Hi,

        Is there anything that can be done to do the above?

        Thank you,

        Comment


          #5
          Have you tried something like (SmartClient syntax):
          Code:
          changed: function(form, item, value) {
              if (value) {
                  var mapped = item.getDisplayValue(value);
                  if (!mapped) {
                      item.setValue(null);
                  }
              }
          }
          Doesn't prevent free-form entry but does clear it if not valid in the list.

          Comment


            #6
            Thanks for your answer David but it did not work in smartgwt.

            I found the method setRejectInvalidValueOnChange(true) but it did not work.

            Anyone knows what is the cause?

            I am using SmartGwt 2.0

            Comment

            Working...
            X