mirror of
https://github.com/bodyrep/DemoApp.git
synced 2026-01-25 14:43:00 +00:00
fixed validation for exercise creation (inlcuding unique exercise name), also added ability to edit exercises
This commit is contained in:
@@ -16,7 +16,15 @@ $("#newexercise").validate({
|
||||
}
|
||||
},
|
||||
dataFilter: function(data) {
|
||||
return (JSON.parse(data).name);
|
||||
if($("#name").attr("value") === $("#name").attr("oldvalue") ) {
|
||||
console.log("Old = New " + JSON.parse(data).name);
|
||||
return JSON.stringify(true);
|
||||
//return $.toJSON(true);
|
||||
} else {
|
||||
console.log("Old != New");
|
||||
return (JSON.parse(data).name);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -46,13 +54,11 @@ $(".musclearray").each(function(){
|
||||
$(this).rules("add", {
|
||||
required: true,
|
||||
digits: true,
|
||||
range: [1, 10],
|
||||
range: [0, 10],
|
||||
messages: {
|
||||
required: "Muscle Array values must be betwen 1 and 10"
|
||||
required: "Muscle Array values must be betwen 0 and 10"
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
|
||||
});
|
||||
Reference in New Issue
Block a user