How to use Jquery Validation with jEditable in DataTables -
i looked @ of other questions couldn't solutions work. i'm using code in datatables validate jeditable field:
$('#example tbody .samples').editable( 'jeditable_ajax.php', { submitdata: function ( value, settings ) { return { row_id: otable.fngetdata(otable.fngetposition(this)[0],0), column: otable.fngetposition(this)[2] }; }, onsubmit: function(settings, td){ console.log($(this)); console.log($(this).find('input').attr('name')); $(this).validate({ debug: true, rules: { value: { required: true, number: true } }, messages: { value: "error" }, errorclass: "invalid", submithandler: function() { alert("success!"); } }); return ($(this).valid()); }, onblur: "submit", placeholder: " ", tooltip: "click edit" } );
i don't debug errors jquery validation (with debug: true
on), , jeditable field seems automatically have name of value (ie: <input type="text" name="value"/>
, confirmed console.log($(this).find('input').attr('name'));
.
the errorclass
isn't applied , no error messages non-number data.
for reason code works, if copy/paste above block of code, didn't before... i've got no idea why.
Comments
Post a Comment