jqBootstrapValidation icon indicating copy to clipboard operation
jqBootstrapValidation copied to clipboard

empty select null value error

Open btantlinger opened this issue 12 years ago • 3 comments

I have a form where a selects options are populated via ajax, and can be empty, under certain conditions.

If a select field is empty (i.e 0 options) and you try to submit a form, validation fails because .val() will return null.

The problem seems to be on line 864 of jqBootstrapValidation. Adding the following below that line seems to fix it.

if(value == null) value = '';

btantlinger avatar Dec 21 '12 22:12 btantlinger

Hi @btantlinger ;

Changing it there might have repercussions elsewhere. What validator(s) were you using that caused the error when they got a 'null' back?

Thanks

ReactiveRaven avatar Dec 23 '12 07:12 ReactiveRaven

The only validation on the select was required. If it has 0 options, it appears to return null.

btantlinger avatar Dec 24 '12 19:12 btantlinger

I'm having the same issue. Any advice?

skybondsor avatar Apr 11 '14 12:04 skybondsor