onsubmit validation option of infragistics igeditor not working
http://stackoverflow.com/questions/18442269/onsubmit-validation-option-of-infragistics-igeditor-not-working
HTML
<script src="http://cdn-na.infragistics.com/jquery/20131/latest/js/infragistics.loader.js"></script>
<form id="form" action="" method="POST">
<table id="formtable">
<tr>
<td id="label1">
<td id="editor1">
</tr>
<tr>
<td id="label2">
<td id="editor2">
</tr>
</table>
<input type="button" value="Save" id="save" />
</form>
JavaScript
$.ig.loader({
scriptPath: 'http://cdn-na.infragistics.com/jquery/20131/latest/js/',
cssPath: 'http://cdn-na.infragistics.com/jquery/20131/latest/css/',
theme: 'metro'
});
$.ig.loader("igEditors,igValidator", function () {
var label1 = document.createElement('label');
var input1 = $('<input id="txt1"/>');
var label2 = document.createElement('label');
var input2 = $('<input id="txt2"/>');
label1.innerHTML = "First Name";
label2.innerHTML = "Last Name";
$("#label1").append(label1);
$("#label2").append(label2);
$("#editor1").append(input1);
$("#editor2").append(input2);
$(input1).igEditor({
width: 140,
required: true,
validatorOptions: {
onchange: true,
formSubmit: true
}
});
$(input2).igEditor({
width: 140,
required: true,
errorMessage: "Should contain at least 8 characters, 1 number, 1 lowercase character (a-z), 1 uppercase character",
validatorOptions: getValid(input2.value , 1),
});
$('#save').click(function () {
var form = $('#form')[0];
form.submit();
});
function getValid (value, fieldOptions){
var myRegEx = /^(?=.*[0-9])(?=.*[a-z])(?=.*[A-Z])([a-zA- Z0-9]{8,})$/;
var isValid = myRegEx.test(value);
return isValid;
}
});