我有4个下拉列表框,即year,make,model,sumbodel
和一个文本框(即)里程,如果我选择年份和里程而不选择其他,则应显示错误消息。但它正在重定向到结果页面。如何停止重定向到结果页面,它必须显示错误消息
if ( typeof ScheduledMaintenance.scheduledMaintenanceForm !== 'function' ) {
ScheduledMaintenance.scheduledMaintenanceForm = {
submitScheduledMaintenanceForm : function () {
var acesVehicleId = this.sanitizeScheduledMaintenanceURLNumber($("#acesVehicleIdHidden").val());
var year = this.sanitizeScheduledMaintenanceURLNumber($("#year option:selected").text());
var make = this.sanitizeScheduledMaintenanceURLString($("#make option:selected").text());
var model = this.sanitizeScheduledMaintenanceURLString($("#model option:selected").text());
var submodel = this.sanitizeScheduledMaintenanceURLString($("#submodel option:selected").text());
var mileage = this.sanitizeScheduledMaintenanceURLNumber($("#mileage").val());
var scheduledMaintenanceURL = "/vehicle-scheduled-maintenance/"+acesVehicleId;
if (mileage != null && mileage.length > 0) {
scheduledMaintenanceURL += "/"+mileage;
}
scheduledMaintenanceURL += "/"+year+"-"+make+"-"+model;
if (submodel != null && submodel.length > 0 && submodel != "Default") {
// some submodels consist of nothing but special characters, so don't use those
scheduledMaintenanceURL += "-"+submodel;
}
scheduledMaintenanceURL += "/listServices.htm";
window.location = scheduledMaintenanceURL;
},