jQuery Ajax validation and DataAnnotations attribues -
i created form posts , gets results through jquery ajax. need put validation stuff on it. wonder how it. should use jquery validation plugin? if use , if i'm guessing right - there no need decorate model dataannotations attributes, no longer gonna make sense, right?
so i'm saying: use normal html form html.beginform(), not ajax form, override form's submit() function
$("form[action$='updatecalendarform']").submit(function () { $.ajax({ url: $(this).attr("action"), contenttype: 'application/json; charset=utf-8', type: "post", data: json.stringify(calendardata), datatype: "json", success: updatecalendarcallback }); return false; // wouldn't rerender page }); function updatecalendarcallback(result){ // , here on page } what's best way add validation here without ajax helper methods (but using jquery) , dataannotations attributes on model properties.
brad wilson had great video on mvcconf validation. here's need know start implementing custom validation on mvc3
Comments
Post a Comment