Announcement

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

    ComboBoxItem with specialValues and allowEmptyValue

    Hello Isomorphic,

    I came across this code in the ComboBoxItem init function:
    Code:
            if (this.specialValues && this.allowEmptyValue) {
               // Default is allowEmptyValue:true so a warning will be unhelpful
                this.allowEmptyValue = false;
            }
    Can you explain why allowEmptyValue should not be set together with specialValues?

    Thanks

    #2
    This is a great example of why you should look at docs first and source code only in desperation. The docs for comboBoxItem.specialValues explicitly cover allowEmptyValue - you need to include an empty value in the specialValues if you want to have one.

    Comment


      #3
      I admit I did not notice that comment on the documentation of comboBoxItem.specialValues.
      However, the documentation only states the fact (which I have figured by looking at the code), but it does not explain why was that limitation put in place?
      I am using special values with a separate values list and I don't want to have a special value for clearing the combo box - I just want to allow the user to delete the value in regular manner (using backspace or delete keys on the keyboard).

      From my experiment, setting the allowEmptyValue back to true immediately after initializing the control does the trick, but I suspect I'm probably missing something because allowEmptyValue is documented as IR.
      Could you explain the reason form this limitation and what issue I might expect using my solution (if any)?

      Thanks

      Comment


        #4
        You can expect that things explicitly prohibited in the documentation will not actually work... they may of course superficially appear to work, but they won't ultimately.

        Have you looked at what allowEmptyValue does on a ComboBox? Users are not in general prevented from emptying the input field in the usual way, unless addUnknownValues has been set false.

        As far as why we did it this way, both allowEmptyValue and specialValues require special entries to appear before the normal dataset, and doing this with two different mechanism would be needlessly complex.



        Comment


          #5
          In my case addUnknownValues is indeed set to false - I don't want to allow users to enter just any unknown value, but I do want to allow them to clear the current value without actually adding an empty value to the pick list (or to the separate values list).
          The fact is that unless I use special values, the combination of addUnknownValues=false and allowEmptyValue=true is supported and does exactly what I want, but once I use also special values, that combination becomes unsupported and forces me to add an empty value to the (separate values) list...
          I cannot understand why adding special values should limit that functionality which exists without it.

          Without presuming to do your work for you, I would like to suggest that the condition in the code I referenced in my original post should probably also check for addUnknownValues before reverting allowEmptyValue to false.

          Thanks

          Comment

          Working...
          X