function validateFlyDriveDateFormat(fieldName,error,componentId, defaultVal){ if(isKeyboard()) { if(!isValidDate(jQuery("#"+fieldName).val())) { showFlyDriveErrorMsg(fieldName,error,componentId, defaultVal); return true; } } return false; } function checkMandatoryFlyDrive(fieldName,error,componentId, defaultVal) { if ((jQuery("#"+fieldName).val() == "") || (jQuery("#"+fieldName).val().indexOf(defaultVal) >= 0)) { showFlyDriveErrorMsg(fieldName,error,componentId, defaultVal); return true; } return false; } function showFlyDriveErrorMsg(fieldName,error,componentId, defaultVal) { jQuery("#labelErrorMsgCar_"+componentId).text(error); jQuery("#"+fieldName).focus(); } function doFlyDriveSubmit(componentId) { // if we are in accessibility mode we show more informative error msg if(isKeyboard()) { if (validateFlyDriveDateFormat("flyCheckInDate_"+componentId,'',componentId, 'Departure')) return; if (checkMandatoryFlyDrive("flyCheckInDate_"+componentId,'',componentId, 'Departure')) return; if (validateFlyDriveDateFormat("flyCheckOutDate_"+componentId,'',componentId, 'Return')) return; if (checkMandatoryFlyDrive("flyCheckOutDate_"+componentId,'',componentId, 'Return')) return; // this check is only for accessibility!!!! cause here we remove 'calendarSearchTrigger' and there we are checking if the destination is not empty if(checkMandatoryFlyDrive("flyDest_"+componentId,'Destination' , componentId, 'Destination')) {return;} } else { if (checkMandatoryFlyDrive("flyCheckInDate_"+componentId,'Departure date is a mandatory field',componentId, 'Departure')) return; if (checkMandatoryFlyDrive("flyCheckOutDate_"+componentId,'Arrive date is a mandatory field',componentId, 'Return')) return; } if (!checkFromToDate("flyCheckInDate_"+componentId, "flyCheckOutDate_"+componentId,'Return date must be after depart date', "labelErrorMsgCar_"+componentId)) return; jQuery("#searchBtn").attr("disabled","true"); var message = "Package to-" + jQuery("#flyDest_"+componentId).val() + " " + atDateMsg + " "+ jQuery("#flyCheckInDate_"+componentId).val(); jQuery("#loadingDiv").text(message); if(jQuery("#popupTextChange").length > 0) setPopupText(jQuery("#flyCheckInDate_"+componentId).val(), jQuery("#flyCheckOutDate_"+componentId).val(), '',jQuery("#flyDest_"+componentId).val(),'FlyDrive') $(".loadPopup").bPopup(); navigateToUrl("/SearchFlyDrive.do" , "SearchFlyDrive_" + componentId , "compareList=&"); // focus on loading pop-up for accessibility issues jQuery("#popupLoader").focus(); } $(document).ready(function() { // when in keyboard mode - eliminate calender pop up if (isKeyboard()) { // we are in accessibility mode // remove pop up of select destinaiton jQuery("#flyDest_" + compId).removeClass("flyDriveDest"+compId) jQuery("#flyDest_" + compId).unbind("") // make it possible to write destination jQuery("#flyDest_" + compId).removeAttr("readonly") // remove pop up of select dates jQuery("#flyCheckInDate_" + compId).removeClass("calenderSearchTrigger") jQuery("#flyCheckInDate_" + compId).unbind("") jQuery("#flyCheckOutDate_" + compId).removeClass("calenderSearchTrigger") jQuery("#flyCheckOutDate_" + compId).unbind("") } else { // we are in regular mode - no accessibility issues } });