form validation again
This commit is contained in:
parent
ffa49fd092
commit
9ff60d2ba4
|
@ -26,14 +26,17 @@ $(document).on('click', '#ajax_form_submit', function(){
|
|||
beforeSubmit: function(){
|
||||
var sub = true;
|
||||
$("span.error").remove();
|
||||
$("#dyn_error").empty();
|
||||
$("#ajaxForm input").each(function(){
|
||||
if($(this).val() == ""){
|
||||
$("<span class='error'>Cannot be empty.</span>").insertAfter($(this));
|
||||
$("<span class='error'> *</span>").insertAfter($(this));
|
||||
sub = false;
|
||||
}
|
||||
})
|
||||
if(!sub)
|
||||
if(!sub){
|
||||
$("#dyn_error").text("Cannot be empty.");
|
||||
return false;
|
||||
}
|
||||
},
|
||||
success: function(response,status,xhr){
|
||||
if(typeof tinyMCEPopup != "undefined"){
|
||||
|
|
|
@ -11,3 +11,7 @@
|
|||
.warning{
|
||||
color:orange;
|
||||
}
|
||||
label#dyn_error {
|
||||
|
||||
margin-left: 50%;
|
||||
}
|
|
@ -9,6 +9,7 @@
|
|||
<div class="modal-header">
|
||||
<h3><%= t 'admin.file_upload' %></h3>
|
||||
</div>
|
||||
<label class="control-label error" id="dyn_error"></label>
|
||||
<div class="modal-body form-horizontal">
|
||||
<div class="control-group">
|
||||
<label for="title" class="control-label error"><%= t 'admin.title' %></label>
|
||||
|
|
Loading…
Reference in New Issue