You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
}
The text was updated successfully, but these errors were encountered:
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
}
The text was updated successfully, but these errors were encountered: