validate.js
創(chuàng)新互聯(lián)公司專注為客戶提供全方位的互聯(lián)網(wǎng)綜合服務(wù),包含不限于網(wǎng)站建設(shè)、成都做網(wǎng)站、儋州網(wǎng)絡(luò)推廣、重慶小程序開發(fā)公司、儋州網(wǎng)絡(luò)營銷、儋州企業(yè)策劃、儋州品牌公關(guān)、搜索引擎seo、人物專訪、企業(yè)宣傳片、企業(yè)代運營等,從售前售中售后,我們都將竭誠為您服務(wù),您的肯定,是我們最大的嘉獎;創(chuàng)新互聯(lián)公司為所有大學(xué)生創(chuàng)業(yè)者提供儋州建站搭建服務(wù),24小時服務(wù)熱線:13518219792,官方網(wǎng)址:www.cdcxhl.com
- function AddAbroadTravel(){}
- $().ready(function() {
- $("#abroadtravelForm").validate({
- submitHandler:function(form){
- if(!AddAbroadTravel.validateSchedule()){
- return;
- }
- var form = document.getElementById("abroadtravelForm");
- form.encding="application/x-www-form-urlencoded";
- form.action = "/admin/abroadTravelAction!showAbroadTravel";
- form.target = "_self";
- form.submit();
- },
- rules: {
- "info.travelName": {
- required: true,
- minlength: 2,
- maxlength: 100
- },
- "info.travelDeparture": {
- required: true
- },
- "info.travelDestin": {
- required: true
- },
- "info.travelRoomUsers": {
- required: false,
- digits:true
- },
- "info.travelOnePersonRoom": {
- minlength: 0,
- maxlength: 100
- },
- "info.travelDiningViews": {
- required: false,
- minlength: 0,
- maxlength: 25
- },
- "info.travelHotel": {
- required: false,
- minlength: 0,
- maxlength: 50
- },
- "info.travelTouristGuide": {
- required: false,
- minlength: 0,
- maxlength: 50
- },
- "info.travelConditions": {
- required: false,
- minlength: 0,
- maxlength: 50
- },
- "info.travelPeriod": {
- required: true,
- digits:true
- },
- "info.travelAccomCity": {
- required: false,
- minlength: 0,
- maxlength: 50
- },
- "info.travelFuelCosts": {
- required: false,
- minlength: 0,
- maxlength: 250
- },
- "info.travelLocalTax": {
- required: false,
- minlength: 0,
- maxlength: 250
- },
- "info.travelAirportConstrFee": {
- required: false,
- minlength: 0,
- maxlength: 250
- },
- "info.travelChildrenPrice": {
- required: false,
- minlength: 0,
- maxlength: 250
- },
- "info.travelPoints": {
- required: false,
- minlength: 0,
- maxlength: 250
- },
- "info.travelOtherOptions": {
- required: false,
- minlength: 0,
- maxlength: 250
- },
- "info.travelNotes": {
- required: false,
- minlength: 0,
- maxlength: 250
- },
- "info.travelCommitment": {
- required: false,
- minlength: 0,
- maxlength: 250
- },
- "info.travelDepaTime": {
- required: true
- }
- }
- });
- var initTravelDeparture = jQuery("#initTravelDeparture").val();
- var initTravelDestin = jQuery("#initTravelDestin").val();
- if(!initTravelDeparture)
- initTravelDeparture = "";
- if(!initTravelDestin)
- initTravelDestin = "";
- linkage.init('travelDeparture_select_country','travelDeparture_select_city',initTravelDeparture);
- linkage.init('travelDestin_select_country','travelDestin_select_city',initTravelDestin);
- });
- //上傳景點圖片
- AddAbroadTravel.uploadImg = function(){
- var imgPath = jQuery("#upload").val();
- if(imgPath){
- var form = document.getElementById("abroadtravelForm");
- form.encding="multipart/form-data";
- form.action = "/admin/abroadTravelImgAction";
- form.target = "uploadImgFrame";
- form.submit();
- }
- };
- //刪除景點圖片
- AddAbroadTravel.delImg = function(imgA){
- jQuery(imgA.parentNode.parentNode).remove();
- };
- //追加日程
- AddAbroadTravel.addSchedule = function(){
- var imgsTables = document.getElementById("scheduleTable");
- var tr = imgsTables.insertRow(imgsTables.rows.length);
- var strHtml = '
第'; - strHtml += '日
觀光內(nèi)容: '; - strHtml += '';
- strHtml += '
居住酒店: ';- strHtml += '
'; ';- strHtml += 'X
- tr.innerHTML = strHtml;
- jQuery('#div2 [title]').tipsy({trigger: 'focus',fade: true});
- };
- //刪除日程
- AddAbroadTravel.delSchedule = function(obj){
- jQuery(obj.parentNode.parentNode).remove();
- };
- //驗證日程
- AddAbroadTravel.validateSchedule = function(){
- var scheduleDays = jQuery("input[name='scheduleDay']");
- var scheduleContents = jQuery("textarea[name='scheduleContent']");
- var scheduleHotels = jQuery("input[name='scheduleHotels']");
- var i = 0;
- for(i = 0; i < scheduleDays.length; i++){
- if(!FM.STRING.isNum(jQuery(scheduleDays[i]).val())){
- jQuery(scheduleDays[i]).focus();
- return false;
- }
- }
- for(i = 0; i < scheduleContents.length; i++){
- if(jQuery(scheduleContents[i]).val().length > 250){
- jQuery(scheduleContents[i]).focus();
- return false;
- }
- }
- for(i = 0; i < scheduleHotels.length; i++){
- if(jQuery(scheduleHotels[i]).val().length > 100){
- jQuery(scheduleHotels[i]).focus();
- return false;
- }
- }
- return true;
- };