add show form sent via ajax request, opens sections with errors if not completed properly.
This commit is contained in:
parent
a32550d625
commit
2b5927bf33
6 changed files with 129 additions and 63 deletions
|
@ -127,11 +127,41 @@ function setAddShowEvents() {
|
|||
|
||||
$("#add-show-submit")
|
||||
.button()
|
||||
.click(function(){
|
||||
$("form").submit();
|
||||
.click(function(event){
|
||||
event.preventDefault();
|
||||
|
||||
var data = $("form").serializeArray();
|
||||
var y;
|
||||
|
||||
$.post("/Schedule/add-show", {format: "json", data: data}, function(json){
|
||||
if(json.form) {
|
||||
$("#add-show-form")
|
||||
.empty()
|
||||
.append(json.form);
|
||||
|
||||
setAddShowEvents();
|
||||
showErrorSections();
|
||||
}
|
||||
else {
|
||||
scheduleRefetchEvents();
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function showErrorSections() {
|
||||
|
||||
if($("#schedule-show-when .errors").length > 0) {
|
||||
$("#schedule-show-when").show();
|
||||
}
|
||||
if($("#schedule-show-who .errors").length > 0) {
|
||||
$("#schedule-show-who").show();
|
||||
}
|
||||
if($("#schedule-show-style .errors").length > 0) {
|
||||
$("#schedule-show-style").show();
|
||||
}
|
||||
}
|
||||
|
||||
$(document).ready(function() {
|
||||
|
||||
setAddShowEvents();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue