question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Multiple Attribute Throws error

See original GitHub issue

Hi thanks for this great project. I’m using version 2.0.10 and ran into an edge case that’s throwing an error. The problem is here and caused by modelValue being null.

modelValue is null because I wanted to reset the select to nothing as a cancel button has been clicked. Maybe checking for it’s existence on the offending line or defaulting it to an empty array might fix the problem.

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
lordfriendcommented, Apr 8, 2017

I’ll review this

0reactions
ghiscodingcommented, Apr 7, 2017

Thanks for the reply @lordfriend in my case the quick fix was mostly to remove the possibility of getting an error thrown in the console and yes I have to say that I only changed the line that throw an error on my side. We want to avoid having code throwing error. If we look at the viewValue variable, then the only other place that it could throw an error is on line 1326.

So in the end, that would be 2 lines to change to avoid error thrown

// line 890
// change this
if(isMultiple && viewValue.length === 0) {

// to this
if(isMultiple && (!viewValue || viewValue.length === 0)) {

and next line

// line 1326
// change this
if((typeof count !== 'undefined') && viewValue.length > count) {
..
// to this
if((typeof count !== 'undefined') && (viewValue && viewValue.length > count)) {

This does not change the behavior of the code in any sense, except that it won’t throw false error when viewValue is null and the UI won’t be broken anymore, apart from the select being empty.

Thanks for your plugin, I now use it in all my projects 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

Exception when getting attribute constructor arguments with ...
The problem seems to be the parameters passed to the Test attribute constructor. If one of them is null, ConstructorArguments throw an exception...
Read more >
Attributes and Error Handling
Attributes allow specifying and handling timeouts and handling errors and cancelations. An attribute has a name and a value. The syntax is: name:...
Read more >
Vpc multiple attributes modification is giving exceptions #415
Vpc multiple attributes modification is giving exceptions #415 ... Exception: InvalidParameterCombination: Fields for multiple attribute ...
Read more >
HTML attribute: multiple - HTML: HyperText Markup Language
The Boolean multiple attribute, if set, means the form control accepts one or more values. Valid for the email and file input types...
Read more >
Follow-up -> ERROR: caught BioMart::Exception:
... Query ERROR: caught BioMart::Exception::Usage: Attributes from > multiple attribute pages are not allowed >> genes_map4 <- getBM(attributes=c > ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found