form validation
This commit is contained in:
parent
9196deb997
commit
ffa49fd092
|
@ -23,6 +23,18 @@ $(document).on('click', '#ajax_form_submit', function(){
|
|||
// dataType: 'script',
|
||||
dataType: 'html',
|
||||
url:$("#ajaxForm").attr("action"),
|
||||
beforeSubmit: function(){
|
||||
var sub = true;
|
||||
$("span.error").remove();
|
||||
$("#ajaxForm input").each(function(){
|
||||
if($(this).val() == ""){
|
||||
$("<span class='error'>Cannot be empty.</span>").insertAfter($(this));
|
||||
sub = false;
|
||||
}
|
||||
})
|
||||
if(!sub)
|
||||
return false;
|
||||
},
|
||||
success: function(response,status,xhr){
|
||||
if(typeof tinyMCEPopup != "undefined"){
|
||||
var x = response.split("#");
|
||||
|
@ -45,18 +57,37 @@ $(document).on('click', '#ajax_form_submit', function(){
|
|||
tinyMCEPopup.close();
|
||||
}else{
|
||||
//incase if we want to do something for quick edit file upload
|
||||
// $("#modal-file").modal('hide');
|
||||
// var modalvalues = "";
|
||||
// var r = "";
|
||||
// if(rcom.getInternetExplorerVersion() > -1){
|
||||
// r = "<tr><td>" + response + "</td></tr>";
|
||||
// r = r.replace("</a><a","</a></td><td><a");
|
||||
// r = r.replace("**","</td><td>");
|
||||
// r = r.replace("**","</td><td>");
|
||||
// r = $(r);
|
||||
// modalvalues = r.find("span").attr("data-content").split("#");
|
||||
// r.attr("id",r.find("span").attr("for"));
|
||||
// alert(r.html())
|
||||
// var table=document.getElementById(modalvalues[0]);
|
||||
// //var tbody = table.getElementsByTagName("tbody");
|
||||
// var row = table.insertRow(table.rows.length-1);
|
||||
// var c1 = row.insertCell(0),
|
||||
// c2 = row.insertCell(1),
|
||||
// c3 = row.insertCell(2);
|
||||
// c1.innerHTML = r.find("td").eq(0).html();
|
||||
// c2.innerHTML = r.find("td").eq(1).html();
|
||||
// c3.innerHTML = r.find("td").eq(2).html();
|
||||
// var trow = $("#bulletin_files tfoot").find("tr").eq(0);
|
||||
// $("#bulletin_files tbody").append(trow);
|
||||
// }else{
|
||||
|
||||
// response = response.replace("**","");
|
||||
// response = response.replace("**","");
|
||||
// r = $(response);
|
||||
// modalvalues = r.find("span").attr("data-content").split("#");
|
||||
// $('#' + modalvalues[0]+ ' tbody').append(r);
|
||||
// }
|
||||
// $('#bulletin_files tbody').append(r);
|
||||
// console.log(modalvalues[1]);
|
||||
// $("#"+modalvalues[1]).modal('hide');
|
||||
//$('#bulletin_files tbody').append(r);
|
||||
//$(response).fadeIn();
|
||||
}
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue