Commit fb2925a2 by Tom Giannattasio

changed nameString variable

parent a8aa8770
...@@ -37,7 +37,7 @@ $(document).ready(function() { ...@@ -37,7 +37,7 @@ $(document).ready(function() {
// autosave when a field is updated on the subsection page // autosave when a field is updated on the subsection page
$body.on('keyup', '.subsection-display-name-input, .unit-subtitle, .policy-list-value', checkForNewValue); $body.on('keyup', '.subsection-display-name-input, .unit-subtitle, .policy-list-value', checkForNewValue);
$('.subsection-display-name-input, .unit-subtitle, .policy-list-name, .policy-list-value').each(function(i) { $('.subsection-display-name-input, .unit-subtitle, .policy-list-name, .policy-list-value').each(function(i) {
this.nameString = $(this).val(); this.val = $(this).val();
}); });
$("#start_date, #start_time, #due_date, #due_time").bind('change', autosaveInput); $("#start_date, #start_time, #due_date, #due_time").bind('change', autosaveInput);
$('.sync-date, .remove-date').bind('click', autosaveInput); $('.sync-date, .remove-date').bind('click', autosaveInput);
...@@ -244,8 +244,13 @@ function checkForNewValue(e) { ...@@ -244,8 +244,13 @@ function checkForNewValue(e) {
return; return;
} }
this.hasChanged = this.nameString != $(this).val() && this.nameString; if(this.val) {
this.nameString = $(this).val(); this.hasChanged = this.val != $(this).val();
} else {
this.hasChanged = false;
}
this.val = $(this).val();
if(this.hasChanged) { if(this.hasChanged) {
if(this.saveTimer) { if(this.saveTimer) {
clearTimeout(this.saveTimer); clearTimeout(this.saveTimer);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment