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