livevalidation icon indicating copy to clipboard operation
livevalidation copied to clipboard

error validating multi-select (selected index -1)

Open ghadami opened this issue 15 years ago • 1 comments

In the validationFunction there is an acces on element index -1 if nothing is select on a multi select box. var value = (this.elementType == LiveValidation.SELECT) ? this.element.options[this.element.selectedIndex].value : this.element.value; changing this two lines to one line like this works fine in all cases: var value = this.element.value; but maybe the extrawork was done for other browsers (tested this on firefox 3.6.10) so the following will fix the issue and will be 100% compatible with the old code var value = ''; if(this.elementType == LiveValidation.SELECT){ if(this.element.selectedIndex >= 0){ value = this.element.options[this.element.selectedIndex].value } }else{ value = this.element.value; }

ghadami avatar Sep 22 '10 16:09 ghadami

+1. This is an easy fix. Hard to imagine that it is 3 years old. It is the only thing preventing the use of multiselect with LiveValidation. I'm running my own patched version of this right now and it works well.

jimthedev avatar Apr 22 '13 20:04 jimthedev