Can't validate fields with name like "fieldname[]"
If you have select element like this: <select name="degree[]"> <option value="">Select</option> <option value="High School" >High School</option> <option value="Diploma" >Diploma</option> <option value="BA" >BA</option> </select>
new FormValidator('applyform', [{ name: 'degree[]', display: 'Degree', rules: 'required'}], function(errors, e){ /* if(errors.length > 0) is always true even if "degree[]" select is selected*/ });
Fix suggestion, inside attributeValue plugin function, before the last "return", I added
if ((attributeName == 'value') && (element.length > 0) && (element[0].type === 'select-one')) { _v = new Array(); for (i = 0, elementLength = element.length; i < elementLength; i++) { if(element[i][attributeName] && element[i][attributeName].length > 0){ _v.push(element[i][attributeName]); }else{ return ''; // stop looping, found empty value! } } return _v; // return array of collected values }
A pull request would be much appreciated in this area :)
Hi, @rickharrison I would like to work on this issue. Can you please assign me?