For you reference, here is the entire Javascript code. Is there anything here that would cause the form to auto-save?
fd.rendered(function() {
//These two lines go in every form, it ensures that form is not cached and opens on top
fd.clear()
fd.container("Wizard1").widget.$on("update:startIndex", function() {
$('.wizard-progress-bar')[0].scrollIntoView({ behavior: 'smooth' });
});
// Send values to summary tab
fd.container("Wizard1").widget.$on("update:startIndex", function() {
vFName = fd.field('firstName').value;
vLName = fd.field('lastName').value;
vEmail = fd.field('Email').value;
vPhone = fd.field('Phone').value;
vAddress = fd.field('Address').value;
vSpecialRequest = fd.field('specialRequests').value;
vNewAppointment = fd.field('AppointmentType').value;
vPreferredDate = fd.field('preferredDate').value;
vPreferredTime = fd.field('preferredTime').value;
vPatientName = fd.field('patientsName').value;
vAreYouParticipatingEVisit = fd.field('youParticipatingEVisit').value;
// if (vAreYouParticipatingEVisit == 'Yes'){
// vAreYouParticipatingEVisit2 = 'Yes'
// else
// vAreYouParticipatingEVisit2 = 'No'
// }
vIfNotYouWho = fd.field('WhoParticipatingEVisit').value;
vRelationshipPatient = fd.field('relationshipPatient').value;
vTypeVisit = fd.field('typeVisit').value;
vSpecialEvent = fd.field('specialEvent').value;
vLocation = fd.field('Location').value;
vApotexFloor = fd.field('apotexFloor').value;
vHospitalFloor = fd.field('hospitalLocation').value;
vTerracesFloor = fd.field('terracesLocation').value;
vRoomNumber = fd.field('RoomNumber').value;
fd.field('FFirstName').value = vFName;
fd.field('FLastName').value = vLName;
fd.field('FEmail').value = vEmail;
fd.field('FPhoneNumber').value = vPhone;
fd.field('FAddress').value = vAddress;
fd.field('FSpecialRequest').value = vSpecialRequest;
fd.field('FNewReschedule').value = vNewAppointment;
fd.field('FDateVisit').value = vPreferredDate;
fd.field('FTimeVisit').value = vPreferredTime;
fd.field('FPatientName').value = vPatientName;
fd.field('FAreYouParticipating').value = vAreYouParticipatingEVisit;
fd.field('FNotYouWho').value = vIfNotYouWho;
fd.field('FRelationshipPatient').value = vRelationshipPatient;
fd.field('FTypeVisit').value = vTypeVisit;
fd.field('FSpecialEvent').value = vSpecialEvent;
fd.field('FLocation').value = vLocation;
fd.field('FApotexFloor').value = vApotexFloor;
fd.field('FHospitalLocation').value = vHospitalFloor;
fd.field('FTerracesLocation').value = vTerracesFloor;
fd.field('FRoomNumber').value = vRoomNumber;
});
function LockSummaryResults() {
fd.field('FFirstName').disabled = true;
$(fd.field('FFirstName').$el).find('input').css('-webkit-text-fill-color', 'black');
fd.field('FLastName').disabled = true;
$(fd.field('FLastName').$el).find('input').css('-webkit-text-fill-color', 'black');
fd.field('FEmail').disabled = true;
$(fd.field('FEmail').$el).find('input').css('-webkit-text-fill-color', 'black');
fd.field('FPhoneNumber').disabled = true;
$(fd.field('FPhoneNumber').$el).find('input').css('-webkit-text-fill-color', 'black');
fd.field('FAddress').disabled = true;
$(fd.field('FAddress').$el).find('input').css('-webkit-text-fill-color', 'black');
fd.field('FSpecialRequest').disabled = true;
$(fd.field('FSpecialRequest').$el).find('input').css('-webkit-text-fill-color', 'black');
fd.field('FNewReschedule').disabled = true;
$(fd.field('FNewReschedule').$el).find('input').css('-webkit-text-fill-color', 'black');
fd.field('FDateVisit').disabled = true;
$(fd.field('FDateVisit').$el).find('input').css('-webkit-text-fill-color', 'black');
fd.field('FTimeVisit').disabled = true;
$(fd.field('FTimeVisit').$el).find('input').css('-webkit-text-fill-color', 'black');
fd.field('FPatientName').disabled = true;
$(fd.field('FPatientName').$el).find('input').css('-webkit-text-fill-color', 'black');
fd.field('FAreYouParticipating').disabled = true;
$(fd.field('FAreYouParticipating').$el).find('input').css('-webkit-text-fill-color', 'black');
fd.field('FNotYouWho').disabled = true;
$(fd.field('FNotYouWho').$el).find('input').css('-webkit-text-fill-color', 'black');
fd.field('FRelationshipPatient').disabled = true;
$(fd.field('FRelationshipPatient').$el).find('input').css('-webkit-text-fill-color', 'black');
fd.field('FTypeVisit').disabled = true;
$(fd.field('FTypeVisit').$el).find('input').css('-webkit-text-fill-color', 'black');
fd.field('FSpecialEvent').disabled = true;
$(fd.field('FSpecialEvent').$el).find('input').css('-webkit-text-fill-color', 'black');
fd.field('FLocation').disabled = true;
$(fd.field('FLocation').$el).find('input').css('-webkit-text-fill-color', 'black');
fd.field('FApotexFloor').disabled = true;
$(fd.field('FApotexFloor').$el).find('input').css('-webkit-text-fill-color', 'black');
fd.field('FHospitalLocation').disabled = true;
$(fd.field('FHospitalLocation').$el).find('input').css('-webkit-text-fill-color', 'black');
fd.field('FTerracesLocation').disabled = true;
$(fd.field('FTerracesLocation').$el).find('input').css('-webkit-text-fill-color', 'black');
fd.field('FRoomNumber').disabled = true;
$(fd.field('FRoomNumber').$el).find('input').css('-webkit-text-fill-color', 'black');
}
function hideOrShowApotexFloor() {
if (fd.field('Location').value == 'Apotex Nursing Home') {
// Show the Apotex Floor field
$(fd.field('apotexFloor').$parent.$el).show();
fd.field('hospitalLocation').value = '';
fd.field('terracesLocation').value = '';
$(fd.field('FApotexFloor').$parent.$el).show();
fd.field('FHospitalLocation').value = '';
fd.field('FTerracesLocation').value = '';
} else {
// Hide the Apotex Floor field
$(fd.field('apotexFloor').$parent.$el).hide();
$(fd.field('FApotexFloor').$parent.$el).hide();
}
}
function hideOrShowHospitalLocation() {
if (fd.field('Location').value == 'Hospital') {
// Show the Apotex Floor field
$(fd.field('hospitalLocation').$parent.$el).show();
fd.field('apotexFloor').value = '';
fd.field('terracesLocation').value = '';
$(fd.field('FHospitalLocation').$parent.$el).show();
fd.field('FApotexFloor').value = '';
fd.field('FTerracesLocation').value = '';
} else {
// Hide the Apotex Floor field
$(fd.field('hospitalLocation').$parent.$el).hide();
$(fd.field('FHospitalLocation').$parent.$el).hide();
}
}
function hideOrShowTerracesLocation() {
if (fd.field('Location').value == 'Terraces Retirement Home') {
// Show the Apotex Floor field
$(fd.field('terracesLocation').$parent.$el).show();
fd.field('apotexFloor').value = '';
fd.field('hospitalLocation').value = '';
$(fd.field('FTerracesLocation').$parent.$el).show();
fd.field('FApotexFloor').value = '';
fd.field('FHospitalLocation').value = '';
} else {
// Hide the Apotex Floor field
$(fd.field('terracesLocation').$parent.$el).hide();
$(fd.field('FTerracesLocation').$parent.$el).hide();
}
}
function hideOrShowIfNotYouWhoWillbeAttending() {
if (fd.field('youParticipatingEVisit').value == 'No') {
// Show the Apotex Floor field
$(fd.field('WhoParticipatingEVisit').$parent.$el).show();
fd.field('WhoParticipatingEVisit').required = true;
$(fd.field('FNotYouWho').$parent.$el).show();
// fd.field('FNotYouWho').required = true;
// fd.field('apotexFloor').value = '';
// fd.field('hospitalLocation').value = '';
} else {
// Hide the Apotex Floor field
$(fd.field('WhoParticipatingEVisit').$parent.$el).hide();
fd.field('WhoParticipatingEVisit').required = false;
fd.field('WhoParticipatingEVisit').value = '';
$(fd.field('FNotYouWho').$parent.$el).hide();
// fd.field('FNotYouWho').required = false;
fd.field('FNotYouWho').value = '';
}
}
function setAppointmentType() {
fd.field('AppointmentType').value = "New";
}
// Calling functions when the user selects an option on the Location Dropdown
fd.field('Location').$on('change',hideOrShowApotexFloor);
fd.field('Location').$on('change',hideOrShowHospitalLocation);
fd.field('Location').$on('change',hideOrShowTerracesLocation);
fd.field('youParticipatingEVisit').$on('change',hideOrShowIfNotYouWhoWillbeAttending);
// Calling functions on form loading
LockSummaryResults();
hideOrShowApotexFloor();
hideOrShowHospitalLocation();
hideOrShowTerracesLocation();
hideOrShowIfNotYouWhoWillbeAttending();
setAppointmentType();
fd.field('youParticipatingEVisit').value = 'Yes';
localStorage.clear();
fd.saved(function() {
setTimeout(function() {
fd._showAlert('Thank you, your EVisit was scheduled successfully! You may close this page.');
setAppointmentType();
fd.field('youParticipatingEVisit').value = 'Yes';
}, 0);
})
});