gwtbootstrap3/gwtbootstrap3-extras

Problems with Tags Input component with multi value support

danijelbasic opened this issue · 4 comments

Hi everybody,

Here are the steps to reproduce the problem:

  1. create a simple form (UI Binder template) by using bootstrap3 Form widget
  2. place MVTagsInput widget in the form as well as one button for the form submission
  3. implement a simple handler for the button - it reads a value (via getValue() method) from the input field and logs it
  4. open the host page which will show the form, do not enter anything in the provided input field, and press the submit button

In Chrome console, you should see the error:
Uncaught com.google.gwt.event.shared.UmbrellaException: Exception caught: (TypeError) : Cannot read property 'length' of null

I think that the problem is in the implementation of org.gwtbootstrap3.extras.tagsinput.client.ui.base.TagsInputBase.toMultiValue() method - a special case when null is passed as the argument is not handled, so the 'for loop' condition statement breaks.

Workaround:
If I set an empty string for 'value' attribute in UIBinder template, there's no the error anymore. But in this case, empty string should be handled properly in the business logic.

Hi again,

Actually, the problem occurs if getValue() is called on instance of MVTagsInput. If getItems() is called, everything works as expected.

@markonikolic Could you please take a look at this issue? Thanks

Fixed, a pull requested #315 has been created.

Thanks @danijelbasic for reporting.

@markonikolic Thank you very much :-)