重庆分公司,新征程启航
为企业提供网站建设、域名注册、服务器等服务
validate.js
创新互联公司专注为客户提供全方位的互联网综合服务,包含不限于网站建设、成都做网站、儋州网络推广、重庆小程序开发公司、儋州网络营销、儋州企业策划、儋州品牌公关、搜索引擎seo、人物专访、企业宣传片、企业代运营等,从售前售中售后,我们都将竭诚为您服务,您的肯定,是我们最大的嘉奖;创新互联公司为所有大学生创业者提供儋州建站搭建服务,24小时服务热线:13518219792,官方网址: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 += '日
观光内容: '; - 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;
- };