PHPjs验证非空

 
<?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)