`

PHPjs验证非空

    博客分类:
  • PHP
 
阅读更多
 
<?php
   $options=array('1'=>'Male','2'=>'Female');
   $GLOBALS['pay_method_strings']['pay_interval_list']=array (
        '' => '',
        '1' => '月结',
        '2' => '季度结',
        '3' => '年结',
        '4' => '其它',
    );

         $GLOBALS['app_list_strings']['type_list']=array (
          '1' => '国有企业',
          '2' => '事业单位',
          '3' => '部队单位',
          '4' => '私营企业',
          '5' => '外资企业',
          '6'=>'合资企业',
        );
        $GLOBALS['app_list_strings']['size_list']=array (
            '' => '',
            '1' => '100以下',
            '2' => '100——500',
            '3' => '500——1000',
            '4' => '1000——2000',
            '5' => '2000——3000',
            '6' => '3000——4000',
            '7' => '4000——5000',
            '8' => '5000——10000',
            '9' => '10000以上',
          );  
            
        $GLOBALS['app_list_strings']['source_list']=array (
          '' => '',
          '1' => '陌生拜访',
          '2' => '收购',
          '3' => '公司拓展',
          '4' => '代理商',
          '5' => '百度',
          '6'=>'集客部',
          '7'=>'客户口碑',  
        );
        $GLOBALS['app_list_strings']['status_list']=array (
                 '' => '',
                 '1' => '意向中',
                 '2' => '已放弃',
                 '3' => '试用',
                 '4' => '运营中',
                 '5' => '中止',
                 '6'=>'到期停止',
               );
         $GLOBALS['app_list_strings']['contract_status_list']=array (
                 '' => '',
                 '1' => '有',
                 '2' => '无',
                 '3' => '报备单',
               );
          $GLOBALS['app_list_strings']['pay_method_list']=array (
            '' => '',
            '1' => '现金',
            '2' => '支票',
            '3' => '转账(电汇)',
            '4' => '其他',
          );
         $GLOBALS['app_list_strings']['pay_with_card_list']=array (
            '' => '',
            '0' => '不支持',
            '1' => '企业工卡',
            '2' => '其他卡',
            
          );



    ?>

<div class="customers form">
    <style >
        .inputCSS{
            float: left;
            width: 250px;
            size: 15px;        
        }
        .inputRequired{
            float: left;
            width: 250px;
            size: 15px;          
        }
        .selectRequired
         { float: left;
            width: 260px;
            height: 30px;
        }


        .selectCSS{
            float: left;
            width: 260px;
            height: 30px;
        }
        .lablediv{
            float: left;
            width: 400px;
        }
        .div{
            border: 1px red solid;
        }
       .textareaCSS
       {
         cols:35;
       }
.Messageerror {
	background: transparent url(images/unchecked.gif) no-repeat scroll 0 0;
	padding-left: 16px;
  	padding-bottom: 2px;
  	font-weight: bold;
 	color: #EA5200;
}
.inputerror { border: 1px solid red; }
 
.inputtable tr td div
{
 padding:0px;
  margin:0px;
}
.inputtable tr td p
{
 padding:0px;
 margin:0px;
}
 
.inputtable tr td{
 vertical-align:middle
}
    </style>
    
 
   <?php echo $this->Form->create('Customer',array('onsubmit'=>'return submitValidate()')); ?>
 
    <fieldset style=" border: 1px red solid;">
        <legend><?php echo __('编辑客户');
    echo $this->Form->input('id'); ?></legend>
        <table class="inputtable">
            <tr>
                <td  style="vertical-align:middle" >
                    合作方名称<font color="red">*</font>:
                </td>
                <td>
                    <?php echo $this->Form->input('name', array('class' => 'inputRequired', 'label' => false)); ?>
                </td>
                <td>
                    行业<font color="red">*</font>:
                </td>
                <td>
                    <?php echo $this->Form->select('industry',$options, array('class' => 'selectRequired'));
                    ?>
                </td>
            </tr>
            
             <tr>
                <td  vertical-align="middle" >
                   企业性质<font color="red">*</font>:
                </td>
                <td>
                    <?php echo $this->Form->select('type',$GLOBALS['app_list_strings']['type_list'], array('class' => 'selectRequired', 'label' => false,'div' => false,'onchange'=>'javascript:show("countryTitle","CustomerCountry",this.value,"5,6")'));
 ?>
                </td>
              
                <td>
                    <p id="countryTitle" style="display: none;"> 国家:</p> &nbsp;
                </td>
                <td>
                      <?php echo $this->Form->input('country', array( 'class' => 'inputCSS', 'label' => false,'style' => 'display:none'));?> &nbsp;
                </td>
              </div>
              
            </tr>
            
             <tr>
                <td align="center" >
                    公司人数<font color="red">*</font>:
                </td>
                <td>
                    <?php echo $this->Form->select('size',$GLOBALS['app_list_strings']['size_list'], array('class' => 'selectRequired', 'label' => false)); ?>
                </td>
                <td>
                    联系人<font color="red">*</font>:
                </td>
                <td>
                    <?php echo $this->Form->input('contact_name', array( 'class' => 'inputRequired', 'label' => false));?> 
                </td>
            </tr>

            <tr>
                <td>
                    部门职位<font color="red">*</font>:
                </td>
                <td>
                    <?php echo $this->Form->input('contact_pos', array('class' => 'inputRequired', 'label' => false)); ?>
                </td>
                 <td>
                    手机<font color="red">*</font>:
                </td>
                <td>
                    <?php echo $this->Form->input('contact_mobile', array('class' => 'inputRequired', 'label' => false)); ?> 
                </td>
            </tr>
            
            
            <tr>
               
                <td>
                   固定电话<font color="red">*</font>:
                </td>
                <td>
                    <?php echo $this->Form->input('contact_tel', array( 'class' => 'inputRequired', 'label' => false));?> 
                </td>
                 <td>
                    地址:
                </td>
                <td colspan="3">
                    <?php echo $this->Form->input('address', array('class' => 'inputCSS', 'label' => false)); ?>
                </td>
            </tr>
            
            
              
            
             <tr>
                <td>
                   客户来源<font color="red">*</font>:
                </td>
                <td>

                <?php echo $this->Form->select('source', $GLOBALS['app_list_strings']['source_list'], array('class' => 'selectRequired', 'label' => false,'onchange'=>'javascript:show("inviterTitle","CustomerInviter",this.value,"7")')); ?>
           
                </td>
                <td>
                  <p id="inviterTitle" style="display: none;">  客户名称:</p>
                </td>
                <td>
                    <?php echo $this->Form->input('inviter', array( 'class' => 'inputCSS', 'label' => false,'style' => 'display:none'));?>
                </td>
            </tr>
            <tr>
                <td>
                   合作状态<font color="red">*</font>:
                </td>
                <td>
                   <?php echo $this->Form->select('status', $GLOBALS['app_list_strings']['status_list'], array('class' => 'selectRequired', 'label' => false)); ?><font color="red">*</font>
                </td>
                <td>
                   合同状态<font color="red">*</font>:
                </td>
                <td>
                   <?php echo $this->Form->select('contract_status', $GLOBALS['app_list_strings']['contract_status_list'], array('class' => 'selectRequired', 'label' => false)); ?><font color="red">*</font>
                </td>
               
            </tr>
             <tr> 
 <td>
                 合同编号<font color="red">*</font>:
                </td>
                <td>
                    <?php echo $this->Form->input('contractNumber',array('class' => 'inputRequired','label' => false));?><font color="red">*</font>
                </td>
<td>
                
                </td>
                <td>
                   
                </td>
            </tr>
             <tr>
                <td>
                     签约方全称<font color="red">*</font>:
                </td>
                <td>
                    <?php echo $this->Form->input('full_name', array('class' => 'inputRequired', 'label' => false)); ?><font color="red">*</font>
                </td>
                <td>
                 合同起始日期<font color="red">*</font>:
                </td>
                <td>
                    <?php echo $this->Form->input('contract_start', array( 'label' => false));?> 
                </td>
            </tr>
            <tr>
                <td>
                   合同终止日期<font color="red">*</font>:
                </td>
                <td>
                    <?php echo $this->Form->input('contract_end', array( 'label' => false)); ?> 
                </td>
                <td>
                 运营机器台数<font color="red">*</font>:
                </td>
                <td>
                    <?php echo $this->Form->input('machines', array( 'class' => 'inputRequired', 'label' => false));?> 
                </td>
            </tr>
            <tr>
                <td>
                   固定点位费<font color="red">*</font>:
                </td>
                <td>
                    <?php echo $this->Form->input('fixed_fee', array('class' => 'inputRequired', 'label' => false)); ?>(单位:元/台/月)
                </td>
                <td>
                 浮动点位费<font color="red">*</font>:
                </td>
                <td>
                    <?php echo $this->Form->input('float_fee', array( 'class' => 'inputRequired', 'label' => false));?>
                </td>
            </tr>
             <tr>
                <td>
                    入场费:
                </td>
                <td>
                    <?php echo $this->Form->input('door_fee', array('class' => 'inputCSS', 'label' => false,'onchange'=>'javascript:showPeople("handle","Customerhandle",this.value)')); ?>(单位:元)
                </td>
                <td>
                    <p id="handle"> 经办人:<P> &nbsp;
                </td>
                <td>
                     
                </td>
            </tr>
             <tr>
                <td>
                    电费:
                </td>
                <td>
                    <?php echo $this->Form->input('electric_fee', array('class' => 'inputCSS', 'label' => false)); ?> 
                </td>
                <td>
                    运用补贴:
                </td>
                <td>
                    <?php echo $this->Form->input('subsidy', array( 'class' => 'inputCSS', 'label' => false));?>
                </td>
            </tr>
              
             <tr>
                <td>
                     结算方式<font color="red">*</font>:
                </td>
                <td>
<?php echo $this->Form->select('pay_method',$GLOBALS['app_list_strings']['pay_method_list'], array('class' => 'selectRequired', 'label' => false,'onchange'=>'javascript:show("pay_method_other_title","CustomerPayMethodOther",this.value,"4")'));
                    ?>
                    
                </td>
                <td>
                   <p id="pay_method_other_title" style="display: none;">说明:</P>&nbsp;
                </td>
                <td>
                    <?php echo $this->Form->input('pay_method_other', array( 'class' => 'inputCSS', 'label' => false,'style' => 'display:none'));?>
                </td>
            </tr>
             <tr>
                <td>
                    结算时间<font color="red">*</font>:
                </td>
                <td>
 <?php echo $this->Form->select('pay_interval',$GLOBALS['pay_method_strings']['pay_interval_list'], array('class' => 'selectRequired', 'label' => false,'onchange'=>'javascript:show("pay_interval_other_title","CustomerPayIntervalOther",this.value,"4")'));
                    ?> 
                   
                </td>
                <td>
                    <p id="pay_interval_other_title" style="display: none;">说明:</P>&nbsp;
                </td>
                <td>
                    <?php echo $this->Form->input('pay_interval_other', array( 'class' => 'inputCSS', 'label' => false,'style' => 'display:none'));?>&nbsp;
                </td>
            </tr>
            
           
            
            <tr>
                <td>
                    是否支持刷卡<font color="red">*</font>:
                </td>
                <td> 
 <?php echo $this->Form->select('pay_with_card',$GLOBALS['app_list_strings']['pay_with_card_list'], array('class' => 'selectRequired', 'label' => false));
                    ?>
                   
                </td>
                <td>
                     特殊需求:
                </td>
                <td>
                     <?php echo $this->Form->input('special_demand', array( 'class' => 'inputCSS', 'label' => false));?>
                </td>
            </tr>
            
            
             <tr>
                <td>
                   大区:
                </td>
                <td>
                    <?php echo $this->Form->input('region', array('class' => 'inputCSS', 'label' => false)); ?> <font color="red">*</font>
                </td>
                <td>
                    省:
                </td>
                <td>
                     <?php echo $this->Form->input('province', array( 'class' => 'inputCSS', 'label' => false));?><font color="red">*</font>
                </td>
            </tr>
            
             <tr>
                <td>
                   地市:
                </td>
                <td>
                    <?php echo $this->Form->input('city', array('class' => 'inputCSS', 'label' => false)); ?> <font color="red">*</font>
                </td>
                <td>
                    现市:
                </td>
                <td>
                     <?php echo $this->Form->input('county', array( 'class' => 'inputCSS', 'label' => false));?>
                </td>
            </tr>
            
              <tr>
                <td>
                   开拓人员<font color="red">*</font>:
                </td>
                <td>
                    <?php echo $this->Form->input('bd', array('class' => 'inputRequired', 'label' => false)); ?>  
                </td>
                <td>
                   维护人员<font color="red">*</font>:
                </td>
                <td>
                     <?php echo $this->Form->input('owner', array( 'class' => 'inputRequired', 'label' => false));?>
                </td>
            </tr>
            
            
            <tr>
                <td>合作补充:</td>
                <td colspan="3">  <?php echo $this->Form->input('note', array(  'label' => false,'rows' => '2', 'cols' => '70'));?> </td>
            </tr>

        </table>
         
    </fieldset>
    <?php echo $this->Form->end(__('保存')); ?>
</div>
<div class="actions">
    <h3><?php echo __('Actions'); ?></h3>
    <ul>

       <!-- <li><?php echo $this->Form->postLink(__('Delete'), array('action' => 'delete', $this->Form->value('Customer.id')), null, __('Are you sure you want to delete # %s?', $this->Form->value('Customer.id'))); ?></li>
       <li><?php echo $this->Html->link(__('List Machines'), array('controller' => 'machines', 'action' => 'index')); ?> </li>
        <li><?php echo $this->Html->link(__('New Machine'), array('controller' => 'machines', 'action' => 'add')); ?> </li>
        -->
        
        <li><?php echo $this->Html->link(__('客户列表'), array('action' => 'index')); ?></li>
        
    </ul>
</div>
<script type="text/javascript">
$(document).ready(function(){
 
  $(":input[class$='Required']").bind('onchange',function(){ 
		 RequiredValidate(this);
	} )
	$(":input[class$='Required']").blur(function(){
		RequiredValidate(this);
		}
	)
	 
})
function submitValidate()
{
   var count=0;
   $(":input[class$='Required']").each(function(){

     var v=$(this).val();
     var name=$(this).attr("id");
              if(v=='')
		{
                 count++;alert(count);
                if($(this).parent().find("p").length==0){
                 $(this).addClass("inputerror");
                 $(this).parent().append("<p class='Messageerror'>必填项!</p>"); 
                  
                }
		}else
		{
                $(this).removeClass("inputerror");
		   $(this).parent().find("p").remove();
		} 
  })
alert(count);
 if(count>0)
{
return false;
}else
{
return true;
}
}
 function RequiredValidate(obj)
{
	   var value=obj.value ;
           var name=obj.id;
		if(value=='')
		{
                if($("#"+name).parent().find("p").length==0){
                 $("#"+name).addClass("inputerror");
                 $("#"+name).parent().append("<p class='Messageerror'>必填项!</p>"); 
                }
		}else
		{
                 $("#"+name).removeClass("inputerror");
		   $("#"+name).parent().find("p").remove();
		} 
}
</script>
    
<script >
         function show(titleid,inputid,value,showvalue)
         {
        if (showvalue.indexOf(value)>=0)
            {
               showInput(titleid);
               showInput(inputid);
            }else
            {
                hiddenInput(titleid);
                hiddenInput(inputid);
            }
            
         }
          function showPeople(titleid,inputid,value)
            {
             if (value!="")
                {
                   showInput(titleid);
                   showInput(inputid);
                }else
                {
                    hiddenInput(titleid);
                    hiddenInput(inputid);
                }
            }
         function showInput(id)
         {
             var sbtitle=document.getElementById(id);
               sbtitle.style.display='block';
         }
         function hiddenInput(id)
         {
             var sbtitle=document.getElementById(id);
             sbtitle.style.display='none';
         }
</script>

    PHP编译后的HMLT源文件

 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />	<title>
		友宝中国客户关系管理系统--CRM:
		Customers	</title>
	<link href="/favicon.ico" type="image/x-icon" rel="icon" /><link href="/favicon.ico" type="image/x-icon" rel="shortcut icon" /><link rel="stylesheet" type="text/css" href="/css/cake.generic.css" />    <script type="text/javascript" src="/js/jquery-1.7.1.min.js"></script></head>
<body>
	<div id="container">
		<div id="header">
			<h1><a href="http://cakephp.org">友宝中国客户关系管理系统--CRM</a></h1>
		</div>
		<div id="content">
 
			
			
 
 
 
<div class="customers form">
    <style >
        .inputCSS{
            float: left;
            width: 250px;
            size: 15px;        
        }
        .inputRequired{
            float: left;
            width: 250px;
            size: 15px;          
        }
        .selectRequired
         { float: left;
            width: 260px;
            height: 30px;
        }
 
 
        .selectCSS{
            float: left;
            width: 260px;
            height: 30px;
        }
        .lablediv{
            float: left;
            width: 400px;
        }
        .div{
            border: 1px red solid;
        }
       .textareaCSS
       {
         cols:35;
       }
.Messageerror {
	background: transparent url(images/unchecked.gif) no-repeat scroll 0 0;
	padding-left: 16px;
  	padding-bottom: 2px;
  	font-weight: bold;
 	color: #EA5200;
}
.inputerror { border: 1px solid red; }
 
.inputtable tr td div
{
 padding:0px;
  margin:0px;
}
.inputtable tr td p
{
 padding:0px;
 margin:0px;
}
 
.inputtable tr td{
 vertical-align:middle
}
    </style>
    
 
   <form action="/customers/edit/3" onsubmit="return submitValidate()" id="CustomerEditForm" method="post" accept-charset="utf-8"><div style="display:none;"><input type="hidden" name="_method" value="PUT"/></div> 
    <fieldset style=" border: 1px red solid;">
        <legend>编辑客户<input type="hidden" name="data[Customer][id]" value="3" id="CustomerId"/></legend>
        <table class="inputtable">
            <tr>
                <td  style="vertical-align:middle" >
                    合作方名称<font color="red">*</font>:
                </td>
                <td>
                    <div class="input text"><input name="data[Customer][name]" class="inputRequired" maxlength="50" type="text" value="45" id="CustomerName"/></div>                </td>
                <td>
                    行业<font color="red">*</font>:
                </td>
                <td>
                    <select name="data[Customer][industry]" class="selectRequired" id="CustomerIndustry">
<option value=""></option>
<option value="1" selected="selected">Male</option>
<option value="2">Female</option>
</select>                </td>
            </tr>
            
             <tr>
                <td  vertical-align="middle" >
                   企业性质<font color="red">*</font>:
                </td>
                <td>
                    <select name="data[Customer][type]" class="selectRequired" onchange="javascript:show(&quot;countryTitle&quot;,&quot;CustomerCountry&quot;,this.value,&quot;5,6&quot;)" id="CustomerType">
<option value=""></option>
<option value="1">国有企业</option>
<option value="2" selected="selected">事业单位</option>
<option value="3">部队单位</option>
<option value="4">私营企业</option>
<option value="5">外资企业</option>
<option value="6">合资企业</option>
</select>                </td>
              
                <td>
                    <p id="countryTitle" style="display: none;"> 国家:</p> &nbsp;
                </td>
                <td>
                      <div class="input text"><input name="data[Customer][country]" class="inputCSS" style="display:none" maxlength="50" type="text" value="" id="CustomerCountry"/></div> &nbsp;
                </td>
              </div>
              
            </tr>
            
             <tr>
                <td align="center" >
                    公司人数<font color="red">*</font>:
                </td>
                <td>
                    <select name="data[Customer][size]" class="selectRequired" id="CustomerSize">
<option value=""></option>
<option value="1" selected="selected">100以下</option>
<option value="2">100——500</option>
<option value="3">500——1000</option>
<option value="4">1000——2000</option>
<option value="5">2000——3000</option>
<option value="6">3000——4000</option>
<option value="7">4000——5000</option>
<option value="8">5000——10000</option>
<option value="9">10000以上</option>
</select>                </td>
                <td>
                    联系人<font color="red">*</font>:
                </td>
                <td>
                    <div class="input text"><input name="data[Customer][contact_name]" class="inputRequired" maxlength="50" type="text" value="32" id="CustomerContactName"/></div> 
                </td>
            </tr>
 
            <tr>
                <td>
                    部门职位<font color="red">*</font>:
                </td>
                <td>
                    <div class="input text"><input name="data[Customer][contact_pos]" class="inputRequired" maxlength="50" type="text" value="13520045950" id="CustomerContactPos"/></div>                </td>
                 <td>
                    手机<font color="red">*</font>:
                </td>
                <td>
                    <div class="input text"><input name="data[Customer][contact_mobile]" class="inputRequired" maxlength="20" type="text" value="" id="CustomerContactMobile"/></div> 
                </td>
            </tr>
            
            
            <tr>
               
                <td>
                   固定电话<font color="red">*</font>:
                </td>
                <td>
                    <div class="input text"><input name="data[Customer][contact_tel]" class="inputRequired" maxlength="20" type="text" value="45" id="CustomerContactTel"/></div> 
                </td>
                 <td>
                    地址:
                </td>
                <td colspan="3">
                    <div class="input text"><input name="data[Customer][address]" class="inputCSS" maxlength="255" type="text" value="" id="CustomerAddress"/></div>                </td>
            </tr>
            
            
              
            
             <tr>
                <td>
                   客户来源<font color="red">*</font>:
                </td>
                <td>
 
                <select name="data[Customer][source]" class="selectRequired" onchange="javascript:show(&quot;inviterTitle&quot;,&quot;CustomerInviter&quot;,this.value,&quot;7&quot;)" id="CustomerSource">
<option value=""></option>
<option value="1">陌生拜访</option>
<option value="2">收购</option>
<option value="3">公司拓展</option>
<option value="4" selected="selected">代理商</option>
<option value="5">百度</option>
<option value="6">集客部</option>
<option value="7">客户口碑</option>
</select>           
                </td>
                <td>
                  <p id="inviterTitle" style="display: none;">  客户名称:</p>
                </td>
                <td>
                    <div class="input text"><input name="data[Customer][inviter]" class="inputCSS" style="display:none" maxlength="50" type="text" value="" id="CustomerInviter"/></div>                </td>
            </tr>
            <tr>
                <td>
                   合作状态<font color="red">*</font>:
                </td>
                <td>
                   <select name="data[Customer][status]" class="selectRequired" id="CustomerStatus">
<option value=""></option>
<option value="1">意向中</option>
<option value="2" selected="selected">已放弃</option>
<option value="3">试用</option>
<option value="4">运营中</option>
<option value="5">中止</option>
<option value="6">到期停止</option>
</select><font color="red">*</font>
                </td>
                <td>
                   合同状态<font color="red">*</font>:
                </td>
                <td>
                   <select name="data[Customer][contract_status]" class="selectRequired" id="CustomerContractStatus">
<option value=""></option>
<option value="1" selected="selected">有</option>
<option value="2">无</option>
<option value="3">报备单</option>
</select><font color="red">*</font>
                </td>
               
            </tr>
             <tr> 
 <td>
                 合同编号<font color="red">*</font>:
                </td>
                <td>
                    <div class="input text"><input name="data[Customer][contractNumber]" class="inputRequired" type="text" id="CustomerContractNumber"/></div><font color="red">*</font>
                </td>
<td>
                
                </td>
                <td>
                   
                </td>
            </tr>
             <tr>
                <td>
                     签约方全称<font color="red">*</font>:
                </td>
                <td>
                    <div class="input text"><input name="data[Customer][full_name]" class="inputRequired" maxlength="50" type="text" value="" id="CustomerFullName"/></div><font color="red">*</font>
                </td>
                <td>
                 合同起始日期<font color="red">*</font>:
                </td>
                <td>
                    <div class="input date"><select name="data[Customer][contract_start][month]" id="CustomerContractStartMonth">
<option value="01">January</option>
<option value="02">February</option>
<option value="03">March</option>
<option value="04">April</option>
<option value="05">May</option>
<option value="06">June</option>
<option value="07">July</option>
<option value="08">August</option>
<option value="09" selected="selected">September</option>
<option value="10">October</option>
<option value="11">November</option>
<option value="12">December</option>
</select>-<select name="data[Customer][contract_start][day]" id="CustomerContractStartDay">
<option value="01">1</option>
<option value="02">2</option>
<option value="03" selected="selected">3</option>
<option value="04">4</option>
<option value="05">5</option>
<option value="06">6</option>
<option value="07">7</option>
<option value="08">8</option>
<option value="09">9</option>
<option value="10">10</option>
<option value="11">11</option>
<option value="12">12</option>
<option value="13">13</option>
<option value="14">14</option>
<option value="15">15</option>
<option value="16">16</option>
<option value="17">17</option>
<option value="18">18</option>
<option value="19">19</option>
<option value="20">20</option>
<option value="21">21</option>
<option value="22">22</option>
<option value="23">23</option>
<option value="24">24</option>
<option value="25">25</option>
<option value="26">26</option>
<option value="27">27</option>
<option value="28">28</option>
<option value="29">29</option>
<option value="30">30</option>
<option value="31">31</option>
</select>-<select name="data[Customer][contract_start][year]" id="CustomerContractStartYear">
<option value="2032">2032</option>
<option value="2031">2031</option>
<option value="2030">2030</option>
<option value="2029">2029</option>
<option value="2028">2028</option>
<option value="2027">2027</option>
<option value="2026">2026</option>
<option value="2025">2025</option>
<option value="2024">2024</option>
<option value="2023">2023</option>
<option value="2022">2022</option>
<option value="2021">2021</option>
<option value="2020">2020</option>
<option value="2019">2019</option>
<option value="2018">2018</option>
<option value="2017">2017</option>
<option value="2016">2016</option>
<option value="2015">2015</option>
<option value="2014">2014</option>
<option value="2013">2013</option>
<option value="2012" selected="selected">2012</option>
<option value="2011">2011</option>
<option value="2010">2010</option>
<option value="2009">2009</option>
<option value="2008">2008</option>
<option value="2007">2007</option>
<option value="2006">2006</option>
<option value="2005">2005</option>
<option value="2004">2004</option>
<option value="2003">2003</option>
<option value="2002">2002</option>
<option value="2001">2001</option>
<option value="2000">2000</option>
<option value="1999">1999</option>
<option value="1998">1998</option>
<option value="1997">1997</option>
<option value="1996">1996</option>
<option value="1995">1995</option>
<option value="1994">1994</option>
<option value="1993">1993</option>
<option value="1992">1992</option>
</select></div> 
                </td>
            </tr>
            <tr>
                <td>
                   合同终止日期<font color="red">*</font>:
                </td>
                <td>
                    <div class="input date"><select name="data[Customer][contract_end][month]" id="CustomerContractEndMonth">
<option value="01">January</option>
<option value="02">February</option>
<option value="03">March</option>
<option value="04">April</option>
<option value="05">May</option>
<option value="06">June</option>
<option value="07">July</option>
<option value="08">August</option>
<option value="09" selected="selected">September</option>
<option value="10">October</option>
<option value="11">November</option>
<option value="12">December</option>
</select>-<select name="data[Customer][contract_end][day]" id="CustomerContractEndDay">
<option value="01">1</option>
<option value="02">2</option>
<option value="03" selected="selected">3</option>
<option value="04">4</option>
<option value="05">5</option>
<option value="06">6</option>
<option value="07">7</option>
<option value="08">8</option>
<option value="09">9</option>
<option value="10">10</option>
<option value="11">11</option>
<option value="12">12</option>
<option value="13">13</option>
<option value="14">14</option>
<option value="15">15</option>
<option value="16">16</option>
<option value="17">17</option>
<option value="18">18</option>
<option value="19">19</option>
<option value="20">20</option>
<option value="21">21</option>
<option value="22">22</option>
<option value="23">23</option>
<option value="24">24</option>
<option value="25">25</option>
<option value="26">26</option>
<option value="27">27</option>
<option value="28">28</option>
<option value="29">29</option>
<option value="30">30</option>
<option value="31">31</option>
</select>-<select name="data[Customer][contract_end][year]" id="CustomerContractEndYear">
<option value="2032">2032</option>
<option value="2031">2031</option>
<option value="2030">2030</option>
<option value="2029">2029</option>
<option value="2028">2028</option>
<option value="2027">2027</option>
<option value="2026">2026</option>
<option value="2025">2025</option>
<option value="2024">2024</option>
<option value="2023">2023</option>
<option value="2022">2022</option>
<option value="2021">2021</option>
<option value="2020">2020</option>
<option value="2019">2019</option>
<option value="2018">2018</option>
<option value="2017">2017</option>
<option value="2016">2016</option>
<option value="2015">2015</option>
<option value="2014">2014</option>
<option value="2013">2013</option>
<option value="2012" selected="selected">2012</option>
<option value="2011">2011</option>
<option value="2010">2010</option>
<option value="2009">2009</option>
<option value="2008">2008</option>
<option value="2007">2007</option>
<option value="2006">2006</option>
<option value="2005">2005</option>
<option value="2004">2004</option>
<option value="2003">2003</option>
<option value="2002">2002</option>
<option value="2001">2001</option>
<option value="2000">2000</option>
<option value="1999">1999</option>
<option value="1998">1998</option>
<option value="1997">1997</option>
<option value="1996">1996</option>
<option value="1995">1995</option>
<option value="1994">1994</option>
<option value="1993">1993</option>
<option value="1992">1992</option>
</select></div> 
                </td>
                <td>
                 运营机器台数<font color="red">*</font>:
                </td>
                <td>
                    <div class="input number"><input name="data[Customer][machines]" class="inputRequired" type="number" value="209" id="CustomerMachines"/></div> 
                </td>
            </tr>
            <tr>
                <td>
                   固定点位费<font color="red">*</font>:
                </td>
                <td>
                    <div class="input text"><input name="data[Customer][fixed_fee]" class="inputRequired" maxlength="50" type="text" value="20" id="CustomerFixedFee"/></div>(单位:元/台/月)
                </td>
                <td>
                 浮动点位费<font color="red">*</font>:
                </td>
                <td>
                    <div class="input text"><input name="data[Customer][float_fee]" class="inputRequired" maxlength="255" type="text" value="" id="CustomerFloatFee"/></div>                </td>
            </tr>
             <tr>
                <td>
                    入场费:
                </td>
                <td>
                    <div class="input number"><input name="data[Customer][door_fee]" class="inputCSS" onchange="javascript:showPeople(&quot;handle&quot;,&quot;Customerhandle&quot;,this.value)" type="number" id="CustomerDoorFee"/></div>(单位:元)
                </td>
                <td>
                    <p id="handle"> 经办人:<P> &nbsp;
                </td>
                <td>
                     
                </td>
            </tr>
             <tr>
                <td>
                    电费:
                </td>
                <td>
                    <div class="input text"><input name="data[Customer][electric_fee]" class="inputCSS" maxlength="255" type="text" value="" id="CustomerElectricFee"/></div> 
                </td>
                <td>
                    运用补贴:
                </td>
                <td>
                    <div class="input text"><input name="data[Customer][subsidy]" class="inputCSS" maxlength="255" type="text" value="" id="CustomerSubsidy"/></div>                </td>
            </tr>
              
             <tr>
                <td>
                     结算方式<font color="red">*</font>:
                </td>
                <td>
<select name="data[Customer][pay_method]" class="selectRequired" onchange="javascript:show(&quot;pay_method_other_title&quot;,&quot;CustomerPayMethodOther&quot;,this.value,&quot;4&quot;)" id="CustomerPayMethod">
<option value=""></option>
<option value="1">现金</option>
<option value="2" selected="selected">支票</option>
<option value="3">转账(电汇)</option>
<option value="4">其他</option>
</select>                    
                </td>
                <td>
                   <p id="pay_method_other_title" style="display: none;">说明:</P>&nbsp;
                </td>
                <td>
                    <div class="input text"><input name="data[Customer][pay_method_other]" class="inputCSS" style="display:none" maxlength="255" type="text" value="" id="CustomerPayMethodOther"/></div>                </td>
            </tr>
             <tr>
                <td>
                    结算时间<font color="red">*</font>:
                </td>
                <td>
 <select name="data[Customer][pay_interval]" class="selectRequired" onchange="javascript:show(&quot;pay_interval_other_title&quot;,&quot;CustomerPayIntervalOther&quot;,this.value,&quot;4&quot;)" id="CustomerPayInterval">
<option value=""></option>
<option value="1">月结</option>
<option value="2" selected="selected">季度结</option>
<option value="3">年结</option>
<option value="4">其它</option>
</select> 
                   
                </td>
                <td>
                    <p id="pay_interval_other_title" style="display: none;">说明:</P>&nbsp;
                </td>
                <td>
                    <div class="input text"><input name="data[Customer][pay_interval_other]" class="inputCSS" style="display:none" maxlength="255" type="text" value="" id="CustomerPayIntervalOther"/></div>&nbsp;
                </td>
            </tr>
            
           
            
            <tr>
                <td>
                    是否支持刷卡<font color="red">*</font>:
                </td>
                <td> 
 <select name="data[Customer][pay_with_card]" class="selectRequired" id="CustomerPayWithCard">
<option value=""></option>
<option value="0">不支持</option>
<option value="1" selected="selected">企业工卡</option>
<option value="2">其他卡</option>
</select>                   
                </td>
                <td>
                     特殊需求:
                </td>
                <td>
                     <div class="input text"><input name="data[Customer][special_demand]" class="inputCSS" maxlength="255" type="text" value="" id="CustomerSpecialDemand"/></div>                </td>
            </tr>
            
            
             <tr>
                <td>
                   大区:
                </td>
                <td>
                    <div class="input number"><input name="data[Customer][region]" class="inputCSS" type="number" id="CustomerRegion"/></div> <font color="red">*</font>
                </td>
                <td>
                    省:
                </td>
                <td>
                     <div class="input text"><input name="data[Customer][province]" class="inputCSS" maxlength="20" type="text" value="" id="CustomerProvince"/></div><font color="red">*</font>
                </td>
            </tr>
            
             <tr>
                <td>
                   地市:
                </td>
                <td>
                    <div class="input text"><input name="data[Customer][city]" class="inputCSS" maxlength="20" type="text" value="" id="CustomerCity"/></div> <font color="red">*</font>
                </td>
                <td>
                    现市:
                </td>
                <td>
                     <div class="input text"><input name="data[Customer][county]" class="inputCSS" maxlength="20" type="text" value="" id="CustomerCounty"/></div>                </td>
            </tr>
            
              <tr>
                <td>
                   开拓人员<font color="red">*</font>:
                </td>
                <td>
                    <div class="input text"><input name="data[Customer][bd]" class="inputRequired" maxlength="45" type="text" value="3" id="CustomerBd"/></div>  
                </td>
                <td>
                   维护人员<font color="red">*</font>:
                </td>
                <td>
                     <div class="input text"><input name="data[Customer][owner]" class="inputRequired" maxlength="20" type="text" value="常文斌" id="CustomerOwner"/></div>                </td>
            </tr>
            
            
            <tr>
                <td>合作补充:</td>
                <td colspan="3">  <div class="input textarea"><textarea name="data[Customer][note]" rows="2" cols="70" id="CustomerNote">45</textarea></div> </td>
            </tr>
 
        </table>
         
    </fieldset>
    <div class="submit"><input  type="submit" value="保存"/></div></form></div>
<div class="actions">
    <h3>Actions</h3>
    <ul>
 
       <!-- <li><form action="/customers/delete/3" name="post_50484db8d5420" id="post_50484db8d5420" style="display:none;" method="post"><input type="hidden" name="_method" value="POST"/></form><a href="#" onclick="if (confirm(&#039;Are you sure you want to delete # 3?&#039;)) { document.post_50484db8d5420.submit(); } event.returnValue = false; return false;">Delete</a></li>
       <li><a href="/machines">List Machines</a> </li>
        <li><a href="/machines/add">New Machine</a> </li>
        -->
        
        <li><a href="/customers">客户列表</a></li>
        
    </ul>
</div>
<script type="text/javascript"> 
$(document).ready(function(){
 
  $(":input[class$='Required']").bind('onchange',function(){ 
		 RequiredValidate(this);
	} )
	$(":input[class$='Required']").blur(function(){
		RequiredValidate(this);
		}
	)
	 
})
function submitValidate()
{
   var count=0;
   $(":input[class$='Required']").each(function(){
 
     var v=$(this).val();
     var name=$(this).attr("id");
              if(v=='')
		{
                 count++;alert(count);
                if($(this).parent().find("p").length==0){
                 $(this).addClass("inputerror");
                 $(this).parent().append("<p class='Messageerror'>必填项!</p>"); 
                  
                }
		}else
		{
                $(this).removeClass("inputerror");
		   $(this).parent().find("p").remove();
		} 
  })
alert(count);
 if(count>0)
{
return false;
}else
{
return true;
}
}
 function RequiredValidate(obj)
{
	   var value=obj.value ;
           var name=obj.id;
		if(value=='')
		{
                if($("#"+name).parent().find("p").length==0){
                 $("#"+name).addClass("inputerror");
                 $("#"+name).parent().append("<p class='Messageerror'>必填项!</p>"); 
                }
		}else
		{
                 $("#"+name).removeClass("inputerror");
		   $("#"+name).parent().find("p").remove();
		} 
}
</script>
    
<script > 
         function show(titleid,inputid,value,showvalue)
         {
        if (showvalue.indexOf(value)>=0)
            {
               showInput(titleid);
               showInput(inputid);
            }else
            {
                hiddenInput(titleid);
                hiddenInput(inputid);
            }
            
         }
          function showPeople(titleid,inputid,value)
            {
             if (value!="")
                {
                   showInput(titleid);
                   showInput(inputid);
                }else
                {
                    hiddenInput(titleid);
                    hiddenInput(inputid);
                }
            }
         function showInput(id)
         {
             var sbtitle=document.getElementById(id);
               sbtitle.style.display='block';
         }
         function hiddenInput(id)
         {
             var sbtitle=document.getElementById(id);
             sbtitle.style.display='none';
         }
</script>		</div>
		<div id="footer">
			<a href="http://www.cakephp.org/" target="_blank"><img src="/img/cake.power.gif" alt="友宝中国客户关系管理系统--CRM" border="0" /></a>		</div>
	</div>
	<table class="cake-sql-log" id="cakeSqlLog_134691576850484db8d71d06_00236942" summary="Cake SQL Log" cellspacing="0"><caption>(default) 3 queries took 12 ms</caption>	<thead>
		<tr><th>Nr</th><th>Query</th><th>Error</th><th>Affected</th><th>Num. rows</th><th>Took (ms)</th></tr>
	</thead>
	<tbody>
	<tr><td>1</td><td>SELECT COUNT(*) AS `count` FROM `crm`.`customers` AS `Customer`   WHERE `Customer`.`id` = 3</td><td></td><td style = "text-align: right">1</td><td style = "text-align: right">1</td><td style = "text-align: right">2</td></tr>
<tr><td>2</td><td>SELECT `Customer`.`id`, `Customer`.`name`, `Customer`.`industry`, `Customer`.`type`, `Customer`.`country`, `Customer`.`size`, `Customer`.`contact_name`, `Customer`.`contact_pos`, `Customer`.`contact_mobile`, `Customer`.`contact_tel`, `Customer`.`address`, `Customer`.`source`, `Customer`.`inviter`, `Customer`.`status`, `Customer`.`contract_status`, `Customer`.`contract_number`, `Customer`.`full_name`, `Customer`.`contract_start`, `Customer`.`contract_end`, `Customer`.`machines`, `Customer`.`fixed_fee`, `Customer`.`float_fee`, `Customer`.`door_fee`, `Customer`.`electric_fee`, `Customer`.`subsidy`, `Customer`.`pay_method`, `Customer`.`pay_interval`, `Customer`.`pay_method_other`, `Customer`.`pay_interval_other`, `Customer`.`special_demand`, `Customer`.`pay_with_card`, `Customer`.`region`, `Customer`.`province`, `Customer`.`city`, `Customer`.`county`, `Customer`.`bd`, `Customer`.`owner`, `Customer`.`note`, `Customer`.`created`, `Customer`.`modified`, `Customer`.`topo` FROM `crm`.`customers` AS `Customer`   WHERE `Customer`.`id` = 3    LIMIT 1</td><td></td><td style = "text-align: right">1</td><td style = "text-align: right">1</td><td style = "text-align: right">6</td></tr>
<tr><td>3</td><td>SELECT `Machine`.`id`, `Machine`.`vm_id`, `Machine`.`customer_id` FROM `crm`.`machines` AS `Machine`   WHERE `Machine`.`customer_id` = (3)   </td><td></td><td style = "text-align: right">0</td><td style = "text-align: right">0</td><td style = "text-align: right">4</td></tr>
	</tbody></table>
	    
</body>
</html>

 

分享到:
评论

相关推荐

    php js 表单验证

    本项目以"php js 表单验证"为主题,结合了后端PHP语言和前端JavaScript技术,为用户提供了一个美观且功能强大的表单验证示例,非常适合初学者学习和借鉴。 首先,PHP(Hypertext Preprocessor)是一种广泛用于...

    JS 客户端验证JS 客户端验证JS 客户端验证JS 客户端验证JS 客户端验证

    - 正则表达式在JS验证中广泛用于检查输入的格式,如邮箱验证:`/^\w+@[a-zA-Z_]+?\.[a-zA-Z]{2,3}$/` 4. **jQuery Validation插件**: - 提供的文件`jquery-validation-1.8.0`是jQuery的一个验证插件,它简化了...

    PHP完整表单验证 php源码js+ajaxc

    这个主题,"PHP完整表单验证 php源码js+ajaxc",涉及到使用PHP和JavaScript(配合AJAX)来确保用户在提交表单时输入的数据是有效且符合预期格式的。下面将详细阐述这个过程中的主要知识点。 首先,**非空验证**是...

    php用户注册(前台完美js验证)源代码

    在本项目中,"php用户注册(前台完美js验证)源代码" 提供了一个完整的用户注册功能,结合了PHP和JavaScript技术。这个功能的核心在于确保用户输入的数据在提交到服务器之前进行前端验证,以提高用户体验并减少...

    表单注册验证例子

    常见的后端验证框架有Express.js(Node.js)、Django(Python)、Laravel(PHP)等。 在"注册验证"这个例子中,可能包含了上述验证逻辑的实现代码。前端部分可能涉及HTML表单元素、CSS样式以及JavaScript验证脚本。...

    在线留言表单验证js代码.zip

    本资源“在线留言表单验证js代码.zip”提供了一种JavaScript实现的解决方案,特别适用于创建简洁且功能完善的留言系统。以下是关于这个主题的详细知识点: 1. **JavaScript基础**:JavaScript是一种广泛使用的...

    表单验证方法

    常见的后端语言如PHP、Java、Python、Node.js等都有内置或第三方库用于处理表单验证。 2. RESTful API验证:对于基于API的应用,验证通常发生在接收请求的服务器上。可以使用中间件或库(如Express.js的验证中间件...

    jquery-validate验证框架使用详解及JS文件

    这个插件具有良好的错误提示机制,可以定制化的错误消息,以及支持多种验证规则,如非空、邮箱格式、手机号码等。 二、基本使用 1. 引入依赖:首先,你需要引入jQuery库和jQuery Validate插件的JS文件,例如`...

    PHP 常用表单验证类

    - 验证库集成:可以考虑使用已有的验证库,如` Respect\Validation`或`Validator.js`,它们提供了更丰富的验证规则和更好的灵活性。 总结,PHP中的表单验证是保证数据质量和系统安全的重要环节。通过自定义验证类,...

    jQuery formValidator表单验证插件

    2. **灵活性**:提供多种内置验证规则,如非空、邮箱、手机号码等,同时支持自定义验证规则,满足不同场景需求。 3. **实时反馈**:能在用户输入时即时给出验证结果,提高用户体验。 4. **AJAX验证**:支持异步验证...

    基于jquery的表单验证框架

    - **非空验证**:确保必填字段不为空。 - **格式验证**:检查输入数据是否符合特定格式,如邮箱、电话号码、日期等。 - **长度验证**:限制输入的字符数或单词数。 - **范围验证**:数值、日期等在特定范围内。 - **...

    form验证与动态验证框架

    1. **前端验证**:常见的前端验证技术包括JavaScript和jQuery,通过编写自定义函数或使用库(如Validator.js, jQuery Validation Plugin等)来实现。验证内容包括但不限于:非空检查、邮箱格式、手机号码格式、长度...

    表单验证插件

    2. **多样化验证**:支持各种常见的验证规则,如非空、邮箱、手机号、URL、数字范围等,并可自定义复杂验证逻辑。 3. **实时反馈**:在用户输入时即时进行验证,提供及时的错误提示,改善用户体验。 4. **多语言支持...

    jq验证器插件.zip

    1. **安装与引入**:首先,你需要在项目中引入jQuery库和验证器插件的JS文件。通常,这两个文件可以从CDN(内容分发网络)获取,也可以直接下载到本地项目中。 2. **基本用法**:初始化验证器插件,需要为表单元素...

    Struts简单的Validator 表单验证类

    通过这些配置,开发者可以指定哪些字段需要验证,以及对应的验证规则,如非空检查、长度限制、格式检查等。例如,对于一个必填的用户名字段,你可以这样配置: ```xml ``` 这里的`depends="required"`表示对`...

    第11章 表单与验证

    1. 非空验证:确保所有必需字段已填写,避免提交空数据。 2. 数据类型验证:检查输入是否符合预期的数据类型,如整数、邮箱、日期等。 3. 长度验证:限制输入的字符长度,防止过长的输入导致的问题。 4. 一致性...

    Validation表单验证

    `jQuery.validate()`插件是jQuery中用于表单验证的常见工具,它可以自定义验证规则,如非空、邮箱格式、手机号码等,并提供错误提示。 2. **HTML5验证**: - HTML5引入了一些内置的验证属性,如`required`(必填)...

    jQuery.validate.js

    1. **内置验证规则**:jQuery.validate.js内建了一系列常见的验证规则,如非空、邮箱格式、电话号码、URL等,只需简单配置就能实现基本的验证功能。 2. **错误提示**:当用户输入不符合规则时,jQuery.validate.js...

    简单的表单验证

    在后端服务器,如PHP或Node.js,也需要进行表单验证,因为前端验证可以被绕过。可以使用相同的正则表达式或其他语言提供的验证库来再次检查数据的合法性。 除了正则表达式,还有其他验证方法,如HTML5内置的验证...

Global site tag (gtag.js) - Google Analytics