javascript - onsubmit validation option of infragistics igeditor not working -
here scenario have html page as
<form id="form"> <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>
and @ script side declaring , appending table elements
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"; $(input1).igeditor({ width: 140, required:true, validatoroptions: { onchange: false, formsubmit: true, } }); $(input2).igeditor({ width: 140, required:true, validatoroptions: { onchange: false, formsubmit: true, } }); $("#label1").append(label1); $("#label2").append(label2); $("#editor1").append(input1); $("#editor2").append(input2);
and on save click writing code as
$('#save').click(function () { $('#form').submit(); });
but on form submitting validation error messages not being displayed , form submitted. rest other validations onchange , onblur working. can me plz????
i'm willing bet igvalidator has has hard time attaching form submit event because create editors in document fragments (via jquery) not yet inside dom, let alone inside form bind to. simple solution though - if insist on creating inputs via js, attach them before intializing igeditors:
fiddle: http://jsfiddle.net/damyanpetev/u9sjp/
$("#label1").append(label1); $("#label2").append(label2); $(input1).igeditor({ width: 140, required: true, validatoroptions: { onchange: true, formsubmit: true } });
remember there's yet submit option (using input tag of type submit) handled separately - there's very elaborate sample on editor options do.
Comments
Post a Comment