formio / formio.js

JavaScript powered Forms with JSON Form Builder

Home Page:https://formio.github.io/formio.js

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Select / SetValue / TriggerUpdate with only string parameters

ssabw1 opened this issue · comments

this.triggerUpdate(_.get(value.data || value, searchProperty, value), true);

We have a case that this function takes the next parameters:
this.triggerUpdate(_.get(undefined || 'Cardiff', 'search', 'Cardiff'), true);

In this case we get an empty function like function search() { [native code] } and this causes to throw an error.

Maybe need to check this case like:

        var defaultValue = value;
        value = !value.data && typeof value === 'string' && typeof searchProperty === 'string' && !!searchProperty.length ? {[searchProperty]: value} : value;
        this.triggerUpdate(_.get(value.data || value, searchProperty, defaultValue), true);

Or maybe have another solution?

Thanks a lot.