一般来说不同的name可以区分不同的区域

解决方案 »

  1.   

    <{if $error_msg_point.point neq ""}><div class="err_warn"><{$error_msg_point.point}></div><{/if}> ·············tpl里面的代码
    这句代码会显示所有错误信息,如果修改参数point,错误信息就没有了,,
    要加一个判断什么的,if($member_id===this.id){
     $smarty->assign("error_msg_point", $error_msg);  ··························    php页面的代码
    }这个是我写的,测试了没反应。。
      

  2.   

       <{if $error_msg_point.point neq ""  and member_id eq "this.id" }><div class="err_warn"><{$error_msg_point.point}></div><{/if}>加了一个 member_id eq "this.id"。。错误信息显示不了了
      

  3.   

    这个是JS 实现的么,那你在获取事件大的时候加上$this
      

  4.   

    用js实现
    可以用唯一id区分;
    按钮点击事件把唯一id当参数传入,例<button onclick="btnClick('err_warn唯一id')">在function btnClick里面就可以去到下面的div了<div id="err_warn唯一id"></div>
      

  5.   


    <td style="word-break: break-all; word-wrap:break-word;"><input type="text" name="<{$selList[loop].member_id}>_point" id="<{$selList[loop].member_id}>_point"maxlength="5" value="" style="ime-mode:disabled;margin-left:10px;margin-right:10px;width:80px"><b><{t}>pt<{/t}></b>
    <input type="button" name="btn_<{$selList[loop].member_id}>_point" id="btn_<{$selList[loop].member_id}>_point" value="<{t}>付与する<{/t}>" style="margin-left:10px;margin-right:10px" class="buttons" onclick="javascript:setpoint(this.id)">
     <{assign var="memberid" value=$selList[loop].member_id|cat:"_point"}>
    <{$memberid}>
    <{if $error_msg_point.$memberid neq "" }><div class="err_warn"><{$error_msg_point.$memberid}></div><{/if}>
    </td>这是tpl里面的代码,onclick="javascript:setpoint(this.id)。。然后要在php页面写一个判断, if(!isset($form["memberid"]) || trim($form["memberid"])==""){
    if($jwvalid_res_t === true){
    $jwvalid_res_t = array("memberid"=>array('errorid'=>"A"));
    }else{
    $jwvalid_res_t['memberid'] = array('errorid'=>"A");
    }
    }这是我写的,这样写不行,因为传过来的还是所有的memberid。。要写一个判断,把$memberid带进去,然后来获取唯一的值。我不会写判断
    Quote: 引用 6 楼 zhangbin1988 的回复:
    /quote]
      

  6.   


    $memberid=$this->getMemberid($form,$check_type);
       if(!isset($form["memberid"]) || trim($form["memberid"])==""){
    if($jwvalid_res_t === true){
    $jwvalid_res_t = array("memberid"=>array('errorid'=>"A"));
    }else{
    $jwvalid_res_t['memberid'] = array('errorid'=>"A");
    }
    } $memberid=$this->getMemberid($form,$check_type);我这样写的没有这个函数,,报错了
      

  7.   

    你JS代码里的setpoint函数是关键。
    先把这个代码贴出来。
      

  8.   


    function SETPOINT($dbh, &$smarty, &$request ){
    if(!$this->checkToken()){
    return $this->INDEX($dbh,$smarty,$request);
    }
    if($_SESSION["login_level"]=="0"||$_SESSION["login_level"]=="1"){
    $form=$request;
    $check_type=array();
    $check_type['point']=array('type'=>'=i','minlen'=>'1', 'maxlen'=>'5');
    $jwvalid_res_t = $this->Check($form,$check_type);
    if($jwvalid_res_t !==true){
    $error_msg= $this->getErrorMsg("pointManagement_check",$jwvalid_res_t);  
               /*$memberid=$form["$memberid"];
        $smarty->assign("memberid", $memberid);
    $jwvalid_res_t = array();
          if(!isset($form["$memberid"]) || trim($form["$memberid"])==""){
       if($jwvalid_res_t === true){
       $jwvalid_res_t = array("$memberid"=>array('errorid'=>"A"));
       }else{
       $jwvalid_res_t['$memberid'] = array('errorid'=>"A");
       }
     } */
     $smarty->assign("error_msg_point", $error_msg);
     $smarty->assign("form", $request);
     return $this->INDEX($dbh,$smarty,$request);
    }
    $dbClass=$this->getDBInstance();
    if(isset($form["member_sel"])&&!EMPTY($form["member_sel"])&&$form["setPointM"]!=""&&strlen($form["setPointM"])<6){
    $member_arr=$form["member_sel"];
    for($i=0;$i<count($member_arr);$i++){
    $sql="update t_member set point=point+(".$form["setPointM"].") where member_id='".getValidDBString($member_arr[$i])."' and status='4' and flg in ('1','2')";
    $dbClass->Execute($sql);
    $sql_point="select point from t_member where member_id='".getValidDBString($member_arr[$i])."' and status='4' and flg in ('1','2')";
    $res_point=$dbClass->SelectAllAssoc($sql_point);
    $sql_id="select nextval('t_point_log_seq') as id ";
    $res_id = $dbClass->SelectAllAssoc($sql_id);
    $point_log_id = $res_id[0]["id"];
    $sql="insert into t_point_log(point_log_id,member_id,point_change,type,created_at,out_id) values('".getValidDBString($point_log_id)."','".getValidDBString($member_arr[$i])."',".$form["setPointM"].",'3',now(),'".getValidDBString($_SESSION["login_account_id"])."')";
    $dbClass->Execute($sql);
    }
    $this->setNoticeMessage($smarty,"pointM|update");
    return $this->INDEX($dbh,$smarty,$request);
     }elseif(isset($form["member_id"])&&$form["member_id"]!=""&&isset($form["point"])&&$form["point"]!=""&&strlen($form["point"])<6){
    $point=$form["point"];
    $member_id=$form["member_id"];
    $sql="update t_member set point=point+(".$point.") where member_id='".getValidDBString($member_id)."' and status='4' and flg in ('1','2')";
    $dbClass->Execute($sql);
    $sql_point="select point from t_member where member_id='".getValidDBString($member_id)."' and status='4' and flg in ('1','2')";
    $res_point=$dbClass->SelectAllAssoc($sql_point);
    $sql_id="select nextval('t_point_log_seq') as id ";
    $res_id = $dbClass->SelectAllAssoc($sql_id);
    $point_log_id = $res_id[0]["id"];
    $sql="insert into t_point_log(point_log_id,member_id,point_change,type,created_at,out_id) values('".getValidDBString($point_log_id)."','".getValidDBString($member_id)."',".$point.",'3',now(),'".getValidDBString($_SESSION["login_account_id"])."')";
    $dbClass->Execute($sql);
    $this->setNoticeMessage($smarty,"pointM|update");
    return $this->INDEX($dbh,$smarty,$request);
     }else{
    $jwvalid_res_t = array();
    if((!isset($form["member_id"])||$form["member_id"]=="")&&(!isset($form["member_sel"])||empty($form["member_sel"]))){
     $jwvalid_res_t ["member"]= array("errorid"=>"A");
    }elseif((!isset($form["point"])||$form["point"]=="")&&(!isset($form["setPointM"])||$form["setPointM"]=="")){
     $jwvalid_res_t ["point"]= array("errorid"=>"A");
    }
    $error_msg= $this->getErrorMsg("pointManagement_check",$jwvalid_res_t);
    }
    $smarty->assign("error_msg", @$error_msg);
    return $this->INDEX($dbh,$smarty,$request);
    }ELSE{
    return $this->location('err.php');
    }
    }  yaozaiphp里面加个判断,,应该是截图的这个位置。
        <{assign var="memberid" value=$selList[loop].member_id|cat:"_point"}>
        <{$memberid}>
    <{if $error_msg_point.$memberid neq "" }><div class="err_warn"><{$error_msg_point.$memberid}></div><{/if}>
                <{if $error_msg_point.point neq "" }><div class="err_warn"><{$error_msg_point.point}></div><{/if}>这个是tpl里面的代码。$memberid。
      

  9.   

    这。。
    我说的是JS代码里的setpoint函数,你是怎么写的?
    先搞清楚服务器端和客户端。
      

  10.   


    function setpoint(id){
    var arr=id.split("_");
    document.getElementById("member_id").value=arr[1];
    document.getElementById("point").value=document.getElementById(arr[1]+"_point").value;
    mySubmit("SETPOINT");
    }不好意思。没反应过来,
      

  11.   

    不可以,,实现不了。
    [引用 2 楼 A9925 的回复:]
    一般来说不同的name可以区分不同的区域
      

  12.   

        
              <html>
              <head>
              <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
              <script type="text/javascript">
              function checkloginblankSubmit(topage,linkflg)
              {       
                          var url = '/cores4/tze5s4t1/pointManagement.php';
                          var pars = '';
                                  
                          var myAjax = new Ajax.Request(
                                   url,
                                   {
                                   method: 'get', 
                                   parameters: pars, 
                                   asynchronous : false,
                                   onComplete: function(originalRequest){
              
                                      if(originalRequest.responseText .indexOf("id=\"AdminLogonForm\"")>=0)
                                       {
                                              var ifflg=false;
                                              var ssi=0;
                                              var htflg=true;
                                              var win = window;
                                              while (win.parent.document.body.innerHTML!=win.document.body.innerHTML) {
                                                  win = win.parent;
                                                  if(win.document.getElementById("iframeTransferTable"))
                                                  {
                                                      htflg=false;
                                                  }
              
                                                  ifflg=true;ssi++;
                                                  if(ssi>10)
                                                      break;
                                              }
                                              
                                              if(parent){
                                                  if(parent.document.formform){
                                                      parent.refresh();
                                                      return
                                                  }
                                              }
                                              mydocObj=win;
                                              mydocObj.location.href="logout.php";
                                              return;
                                       }else{
                                          if(linkflg=="url")
                                          {
                                              window.open(topage); 
                                          }else if(linkflg=="preView"){
                                              preView();
                                          }else{
                                              blankSubmit(topage);
                                          }
                                      }
                                  }
                              });
              
              }
              </script>
              </head>   
              <body vlink="blue" alink="blue" onLoad="baseonloadFunction();onloadFunction();" >
              <div id="content-outer">
              <div class="container" id="mycontainer">
                <script>
                  var flagr=false;
                  var flagl=false;
                  </script>
                <div id="toptab" style="margin: 0px auto;">
                  <div style="float:left;width:50px;display:none;margin-top:8px" id="scrollBtn2">
                      </div>
                      <div style="width:1000px;overflow: hidden; float:left;text-align:left " id="toptab_table">
                          <div style="float:left; " id="communitydivshow">
                    <table border=0 cellspacing=0 cellpadding=0 style="float:left;">
                              <tr>     
             </tr>
                          </table>
                      </div>
                  </div>
                </div>
                <script type="text/JavaScript">
                  if(document.getElementById('smenubox'))
                  {
                  if( window.navigator.userAgent.indexOf("MSIE 9") >=0 ||  window.navigator.userAgent.indexOf("MSIE 8") >=0 )
                          document.getElementById('smenubox').style.marginTop = "0px";
                          }
                  </script>
                  <div border="0" width="100%" id="content-div">
                      <div id="box_content">
                    <form name="mainform" id="mainform" method="post" action="/cores4/tze5s4t1/pointManagement.php" enctype="multipart/form-data" >
                      <script>
                  function setpoint(id){
                      var arr=id.split("_");
                      document.getElementById("member_id").value=arr[1];
                      document.getElementById("point").value=document.getElementById(arr[1]+"_point").value;
                      mySubmit("SETPOINT");
                  }
                  function chksel(){
                      var sel=document.getElementsByName("member_sel[]");
                      var item=0;
                      for(var i=0;i<sel.length;i++){
                          if(sel[i].checked==true){
                              item=item+1;
                          }
                      }
                      if(item>0){
                          if(document.getElementById("setPointM").value==""){
                              alert("付与ポイント数を入力してください");
                              return false;
                          }else{
                              return true;
                          }
                      }else{
                          alert("会員を選択してください");
                          return false;
                      }
                  }
              </script>  
                  <div align="left" style="margin-top:10px;margin-bottom:10px"><b>付与ポイント数</b><input type="text" name="setPointM" id="setPointM" value="" style="ime-mode:disabled;margin-left:10px;margin-right:10px;width:100px" maxlength="5"><b>pt</b><input type="button" name="btn_point" id="btn_point" value="付与する" style="margin-left:10px;margin-right:10px" class="buttons" onClick="javascript:if(chksel()){mySubmit('SETPOINT');}"><br/>
                  </div>
                    <table border="0" align="center" cellpadding="0" cellspacing="1" width="100%" class="table" style="table-layout: fixed;">  
                <tr align="center">
                          <td style="word-break: break-all; word-wrap:break-word;"><input type="checkbox" name="member_sel[]" value="1000255755"><input type="hidden" name="members[]" value="1000255755"></td>
                          <td style="word-break: break-all; word-wrap:break-word;">1000255755</td>
                          <td style="word-break: break-all; word-wrap:break-word;">jyh-a13</td>
                          <td style="word-break: break-all; word-wrap:break-word;">
                          </td>
                          <td  style="word-break: break-all; word-wrap:break-word;"align="center">1</td>
                          <td style="word-break: break-all; word-wrap:break-word;"align="center">0</td>
                          <td style="word-break: break-all; word-wrap:break-word;"><input type="text" name="1000255755_point" id="1000255755_point"maxlength="5" value="" style="ime-mode:disabled;margin-left:10px;margin-right:10px;width:80px"><b>pt</b>
                          <input type="button" name="btn_1000255755_point" id="btn_1000255755_point" value="付与する" style="margin-left:10px;margin-right:10px" class="buttons" onClick="javascript:setpoint(this.id)">
                          <!--          1000255755_point 
                          -->
                        </td>
                          <td style="word-break: break-all; word-wrap:break-word;" align="center">1</td>
                          <td style="word-break: break-all; word-wrap:break-word;">男性</td>
                          <td style="word-break: break-all; word-wrap:break-word;">18</td>
                      </tr>
                          <tr align="center">
                          <td style="word-break: break-all; word-wrap:break-word;"><input type="checkbox" name="member_sel[]" value="1000031784"><input type="hidden" name="members[]" value="1000031784"></td>
                          <td style="word-break: break-all; word-wrap:break-word;">1000031784</td>
                          <td style="word-break: break-all; word-wrap:break-word;">hhh</td>
                          <td style="word-break: break-all; word-wrap:break-word;">
                          </td>
                          <td  style="word-break: break-all; word-wrap:break-word;"align="center">0</td>
                          <td style="word-break: break-all; word-wrap:break-word;"align="center">0</td>
                          <td style="word-break: break-all; word-wrap:break-word;"><input type="text" name="1000031784_point" id="1000031784_point"maxlength="5" value="" style="ime-mode:disabled;margin-left:10px;margin-right:10px;width:80px"><b>pt</b>
                          <input type="button" name="btn_1000031784_point" id="btn_1000031784_point" value="付与する" style="margin-left:10px;margin-right:10px" class="buttons" onClick="javascript:setpoint(this.id)">
                          <!--          1000031784_point 
                          -->
                            </td>
                          <td style="word-break: break-all; word-wrap:break-word;" align="center">0</td>
                          <td style="word-break: break-all; word-wrap:break-word;">女性</td>
                          <td style="word-break: break-all; word-wrap:break-word;">34</td>
                      </tr>
                     </table>
                  <div align="right"><input type="button" name="point_exchange" id="point_exchange" value="交換ポイント情報" style="margin-left:10px;margin-right:10px" class="buttons1" onClick="javascript:mySubmit('EXCHANGE')">
            </div></form>
                  </div></div>
              </div>
              </div>
              </body>
              </html>[引用 15 楼 xuzuning 的回复:]
    你先贴出浏览器中的源代码
      

  13.   

    js 函数 mySubmit 是怎么定义的?
      

  14.   


    function mySubmit(mod, form)
    {
    if( typeof(form) == "undefined" )
    form = document.mainform;
    form.mode.value=mod;
    form.target="_self";
    document.mainform.submit();
    }setPoint函数在10楼
      

  15.   

    这就是要解决的问题。。只让错误信息显示在对应的
    pt下面
    付与ポイント数が正しくありません。
    <{assign var="memberid" value=$selList[loop].member_id|cat:"_point"}>
        <{$memberid}> 
    <{if $error_msg_point.$memberid neq "" }><div class="err_warn"><{$error_msg_point.$memberid}></div><{/if}>这个是tpl模板里面加的代码。要在php里面写个怕段,对应$memberid。参考10楼贴的代码
      

  16.   

    这应该是js 问题  是点击按钮时要显示相应的错误提示吗?如果是这样,每一条记录应该都有一个唯一id,可以在点击按钮的时候 触发方法里传递一个唯一值,错误信息也用唯一id,就可以了
    1,error_meg_1, a(1);
    2,error_meg_2, a(2);
    function a(id){
        $('error_meg_'+id).show();
    }
      

  17.   

    要在php里调用判断一下。也就是php里面function setPoint()里面判断吧。
    你的意思数据有多少天就得写多少个1,error_meg_1, a(1);
    2,error_meg_2, a(2);这样的吗?
      

  18.   

    当你点击付与,调用应该是js 方法吧 是什么方法? 还有就是你那个错误提示有个id,我看你所有错误id都是 err_warn,你这个错貌似是从php端传递过来的,你可以给err_warn加一个id, 比如,err_warn_id(这个id应该是这条记录的唯一值,或者用循环的索引)这样把你点击付与的js事件 贴出来 
      

  19.   


    <td style="word-break: break-all; word-wrap:break-word;"><input type="text" name="<{$selList[loop].member_id}>_point" id="<{$selList[loop].member_id}>_point"maxlength="5" value="" style="ime-mode:disabled;margin-left:10px;margin-right:10px;width:80px"><b><{t}>pt<{/t}></b>
    <input type="button" name="btn_<{$selList[loop].member_id}>_point" id="btn_<{$selList[loop].member_id}>_point" value="<{t}>付与する<{/t}>" style="margin-left:10px;margin-right:10px" class="buttons" onclick="javascript:setpoint(this.id)">
     <{assign var="memberid" value=$selList[loop].member_id|cat:"_point"}>
    <{$memberid}>
    <{if $error_msg_point.$memberid neq "" }><div class="err_warn"><{$error_msg_point.$memberid}></div><{/if}>
    </td>看你这个代码 onclick 调用setpoint(this.id)这个方法,你传递一个唯一值或循环索引:
    如:($selList[loop].id 是唯一值)
    <{t}>付与する<{/t}>" style="margin-left:10px;margin-right:10px" class="buttons" onclick="javascript:setpoint(this.id,$selList[loop].id)">
    <{if $error_msg_point.$memberid neq "" }><div class="err_warn_$selList[loop].id"><{$error_msg_point.$memberid}></div><{/if}>
    <{if $error_msg_point.$memberid neq "" }><div class="err_warn_{$this.}"><{$error_msg_point.$memberid}></div><{/if}>
    function setpoint(id,error_index){
        var arr=id.split("_");
        document.getElementById("member_id").value=arr[1];
        document.getElementById("point").value=document.getElementById(arr[1]+"_point").value;
      if($('err_warn_'+error_index)){
    $('err_warn_'+error_index).show();
    }
        mySubmit("SETPOINT");
    }
      

  20.   

    这是js方法的代码function setpoint(id){
        var arr=id.split("_");
        document.getElementById("member_id").value=arr[1];
        document.getElementById("point").value=document.getElementById(arr[1]+"_point").value;
        mySubmit("SETPOINT");
    }div class="err_warn_memberid" 加了后只是错误信息颜色变了,原本是红色的,变成了黑色、。
    所以要在php里面写个判断吧,你看一下10楼的那个php里面的函数,。。
      

  21.   

    oh, sorry, 我看错了,err_warn是一个class,如果那样的话,你可以不用改class,直接加了id就行了
    如:($selList[loop].id 是唯一值)
    <{t}>付与する<{/t}>" style="margin-left:10px;margin-right:10px" class="buttons" onclick="javascript:setpoint(this.id,$selList[loop].id)">
    <{if $error_msg_point.$memberid neq "" }><div class="err_warn" id="error_meg_$selList[loop].id"><{$error_msg_point.$memberid}></div><{/if}>function setpoint(id,error_index){
        var arr=id.split("_");
        document.getElementById("member_id").value=arr[1];
        document.getElementById("point").value=document.getElementById(arr[1]+"_point").value;
      if($('error_meg_'+error_index)){
    $('err_warn_'+error_index).show();
    }
        mySubmit("SETPOINT");
    }
      

  22.   

    如果你js里没有用到jquery, 可以这样写:function setpoint(id,error_index){
        var arr=id.split("_");
        document.getElementById("member_id").value=arr[1];
        document.getElementById("point").value=document.getElementById(arr[1]+"_point").value;
        if(document.getElementById('error_meg_'+error_index)){//如果存在错误提示 则显示
    document.getElementById('error_meg_'+error_index).style.display = 'block';
        }
        mySubmit("SETPOINT");
      

  23.   

         <{assign var="memberid" value=$selList[loop].member_id|cat:"_point"}
    这个是加在tpl模板里面的。
    22楼标记的元素没有,所以assign了一下。
    <{if $error_msg_point.point neq "" }><div class="err_warn_memberid"><{$error_msg_point.point}></div><{/if}>原本的错误信息
    提示代码
    <{if $error_msg_point.$memberid neq "" }><div class="err_warn_{$this.}"><{$error_msg_point.$memberid}></div><{/if}>
    这句代码输出来的是1000257015_point 。。---->>>>>>>member_id|cat:"_point
    要把这个memberid在弄到php的判断里。
    这两处的代码修改了还是只是颜色变成黑色了
     
     那个div class="err_warn“是所有的错误信息都会调用的。class选择器。所以要把这个memberid对应,要在php页面里面修改。
      

  24.   

    {if $error_msg_point.point neq "" }><div class="err_warn"><{$error_msg_point.point}></div><{/if}>
    原本的是这样的
      

  25.   

    不要改class="err_warn", 直接加一个id,用这个id去获取
      

  26.   

    <{if $error_msg_point.$memberid neq "" }><div class="err_warn" id="error_meg_$selList[loop].memberid"><{$error_msg_point.$memberid}></div><{/if}>
    在这个div里面加东西没影响,我自己修改的时候也加过,也就是说在这里面加其他的代码根本不会运行
      

  27.   

    你看一下10楼的php里面的代码。那个函数,是关键,要在那里面把那个唯一值传过去还是加个判断什么的quote=引用 32 楼 jonlys 的回复:]
    不要改class="err_warn", 直接加一个id,用这个id去获取
      

  28.   

    你看一下10楼的php里面的代码。那个函数,是关键,要在那里面把那个唯一值传过去还是加个判断什么的。谢啦
      

  29.   

    你这个错误提示是JS给出来的吗?
    提示语div与按钮放同个标签下,直接获取当前按钮的父标签的提示语div,改变内容,就行了。
      

  30.   


    <?php 
    $arr = array(
    array('id'=>1,'name'=>"aa",'error_m'=>'this is test1'),
    array('id'=>2,'name'=>"bb",'error_m'=>''),
    array('id'=>3,'name'=>"cc",'error_m'=>'this is test2')
    );
    ?>
    <style>
    .err_warn{
    color:red;
    display:none;
    }
    </style>
    <script>
    function showE(id){
    if(document.getElementById('error_meg_'+id)){//如果存在错误提示 则显示
    document.getElementById('error_meg_'+id).style.display = 'block';
    }
    }
    </script>
    <table>
    <tr>
    <td>id</td>
    <td>name</td>
    <td style="width: 200px;">action</td>
    </tr>
    <?php 
    foreach ($arr as $k=>$v){?>
    <tr>
    <td><?php echo $v['id']?></td>
    <td><?php echo $v['name']?></td>
    <td>
    <a href="javascript:void(0)" onclick="showE(<?php echo $v['id']?>);">Submit</a>
    <?php if(!empty($v['error_m'])){
    echo "<span class='err_warn' id='error_meg_".$v['id']."'>".$v['error_m']."</span>";
    }?>
    </td>
    </tr>
    <?php 
    }
    ?>
    </table>给你个例子 很简单
      

  31.   

    例子是简单,我看了下例子。在看我的问题需要的,修改了修改。还是不行
    。还是要在php里面的函数function SETPOINT($dbh, &$smarty, &$request ){}着手
    Quote: 引用 10 楼 alice8023 的回复:
    function SETPOINT($dbh, &$smarty, &$request ){
    if(!$this->checkToken()){
    return $this->INDEX($dbh,$smarty,$request);
    }
    if($_SESSION["login_level"]=="0"||$_SESSION["login_level"]=="1"){
    $form=$request;
    $check_type=array();
    $check_type['point']=array('type'=>'=i','minlen'=>'1', 'maxlen'=>'5');
    $jwvalid_res_t = $this->Check($form,$check_type);
    if($jwvalid_res_t !==true){
    $error_msg= $this->getErrorMsg("pointManagement_check",$jwvalid_res_t);  
               /*$memberid=$form["$memberid"];
        $smarty->assign("memberid", $memberid);
    $jwvalid_res_t = array();
          if(!isset($form["$memberid"]) || trim($form["$memberid"])==""){
       if($jwvalid_res_t === true){
       $jwvalid_res_t = array("$memberid"=>array('errorid'=>"A"));
       }else{
       $jwvalid_res_t['$memberid'] = array('errorid'=>"A");
       }
     } */
     $smarty->assign("error_msg_point", $error_msg);
     $smarty->assign("form", $request);
     return $this->INDEX($dbh,$smarty,$request);
    }
    $dbClass=$this->getDBInstance();
    if(isset($form["member_sel"])&&!EMPTY($form["member_sel"])&&$form["setPointM"]!=""&&strlen($form["setPointM"])<6){
    $member_arr=$form["member_sel"];
    for($i=0;$i<count($member_arr);$i++){
    $sql="update t_member set point=point+(".$form["setPointM"].") where member_id='".getValidDBString($member_arr[$i])."' and status='4' and flg in ('1','2')";
    $dbClass->Execute($sql);
    $sql_point="select point from t_member where member_id='".getValidDBString($member_arr[$i])."' and status='4' and flg in ('1','2')";
    $res_point=$dbClass->SelectAllAssoc($sql_point);
    $sql_id="select nextval('t_point_log_seq') as id ";
    $res_id = $dbClass->SelectAllAssoc($sql_id);
    $point_log_id = $res_id[0]["id"];
    $sql="insert into t_point_log(point_log_id,member_id,point_change,type,created_at,out_id) values('".getValidDBString($point_log_id)."','".getValidDBString($member_arr[$i])."',".$form["setPointM"].",'3',now(),'".getValidDBString($_SESSION["login_account_id"])."')";
    $dbClass->Execute($sql);
    }
    $this->setNoticeMessage($smarty,"pointM|update");
    return $this->INDEX($dbh,$smarty,$request);
     }elseif(isset($form["member_id"])&&$form["member_id"]!=""&&isset($form["point"])&&$form["point"]!=""&&strlen($form["point"])<6){
    $point=$form["point"];
    $member_id=$form["member_id"];
    $sql="update t_member set point=point+(".$point.") where member_id='".getValidDBString($member_id)."' and status='4' and flg in ('1','2')";
    $dbClass->Execute($sql);
    $sql_point="select point from t_member where member_id='".getValidDBString($member_id)."' and status='4' and flg in ('1','2')";
    $res_point=$dbClass->SelectAllAssoc($sql_point);
    $sql_id="select nextval('t_point_log_seq') as id ";
    $res_id = $dbClass->SelectAllAssoc($sql_id);
    $point_log_id = $res_id[0]["id"];
    $sql="insert into t_point_log(point_log_id,member_id,point_change,type,created_at,out_id) values('".getValidDBString($point_log_id)."','".getValidDBString($member_id)."',".$point.",'3',now(),'".getValidDBString($_SESSION["login_account_id"])."')";
    $dbClass->Execute($sql);
    $this->setNoticeMessage($smarty,"pointM|update");
    return $this->INDEX($dbh,$smarty,$request);
     }else{
    $jwvalid_res_t = array();
    if((!isset($form["member_id"])||$form["member_id"]=="")&&(!isset($form["member_sel"])||empty($form["member_sel"]))){
     $jwvalid_res_t ["member"]= array("errorid"=>"A");
    }elseif((!isset($form["point"])||$form["point"]=="")&&(!isset($form["setPointM"])||$form["setPointM"]=="")){
     $jwvalid_res_t ["point"]= array("errorid"=>"A");
    }
    $error_msg= $this->getErrorMsg("pointManagement_check",$jwvalid_res_t);
    }
    $smarty->assign("error_msg", @$error_msg);
    return $this->INDEX($dbh,$smarty,$request);
    }ELSE{
    return $this->location('err.php');
    }
    }  yaozaiphp里面加个判断,,应该是截图的这个位置。
      

  32.   

    你这个应该是提交过去,如果有错再返回到tpl,然后显示错误,是吗?
    这样的话,也是一样的,你可以把唯一值提交过去,然后在返回到tpl,根绝唯一值来判断。
      

  33.   

    在php里面判断。错误信息的显示在tpl里面。我就不知道怎么在php里面判断。
      

  34.   


       if(!isset($form["$memberid"]) || trim($form["$memberid"])==""){
       if($jwvalid_res_t === true){
       $jwvalid_res_t = array("$memberid"=>array('errorid'=>"A"));
       }else{
       $jwvalid_res_t['$memberid'] = array('errorid'=>"A");
       }
    }  我写的,测试了不行
    $smarty->assign("memberid", $memberid);
    $memberid=$form["$memberid"] 
    这样写呢 
      

  35.   

    当你点击 付与按钮的时候 做了一个什么事情?如果是表单提交,请把提交的信息贴出来,
    还有,如果你那个member id 是唯一的 你就可以根据member id 来判断
    帮相应的错误绑定给相应的member id
    比如你提交过来的$member_id = 5,这时候如果有错:
    $error_arr = array();
    if($error_meg){
       $error_arr[$member_id] = $error_meg;
    }
      

  36.   

    按id去划分就可以啊,遍历的id和后台取过来的id都可以比如是:id="rt1"
    id="rt2"
    ....这样
      

  37.   

    点击按钮时tpl调用的是这个函数。 function setpoint(id){
    var arr=id.split("_");
    document.getElementById("member_id").value=arr[1];
    document.getElementById("point").value=document.getElementById(arr[1]+"_point").value;
    mySubmit("SETPOINT");
    }这是mySubmit函数function mySubmit(mod, form)
    {
    if( typeof(form) == "undefined" )
    form = document.mainform;
    form.mode.value=mod;
    form.target="_self";
    document.mainform.submit();
    }mySubmit("SETPOINT"); 这句里面的SETPOINT是php里面的参数,也就是SETPOINT函数。function SETPOINT($dbh, &$smarty, &$request ){
            if(!$this->checkToken()){
                return $this->INDEX($dbh,$smarty,$request);
            }
            if($_SESSION["login_level"]=="0"||$_SESSION["login_level"]=="1"){
                $form=$request;
                $check_type=array();
                $check_type['point']=array('type'=>'=i','minlen'=>'1', 'maxlen'=>'5');
                $jwvalid_res_t = $this->Check($form,$check_type);
                if($jwvalid_res_t !==true){       
                $error_msg= $this->getErrorMsg("pointManagement_check",$jwvalid_res_t);  
                 $smarty->assign("error_msg_point", $error_msg);
                 $smarty->assign("form", $request);
                 return $this->INDEX($dbh,$smarty,$request);
            }       
                $dbClass=$this->getDBInstance();
                if(isset($form["member_sel"])&&!EMPTY($form["member_sel"])&&$form["setPointM"]!=""&&strlen($form["setPointM"])<6){
                    $member_arr=$form["member_sel"];
                    for($i=0;$i<count($member_arr);$i++){
                        $sql="update t_member set point=point+(".$form["setPointM"].") where member_id='".getValidDBString($member_arr[$i])."' and status='4' and flg in ('1','2')";
                        $dbClass->Execute($sql);   
                        $sql_point="select point from t_member where member_id='".getValidDBString($member_arr[$i])."' and status='4' and flg in ('1','2')";
                        $res_point=$dbClass->SelectAllAssoc($sql_point);
                        $sql_id="select nextval('t_point_log_seq') as id ";
                        $res_id = $dbClass->SelectAllAssoc($sql_id);           
                        $point_log_id = $res_id[0]["id"];   
                        $sql="insert into t_point_log(point_log_id,member_id,point_change,type,created_at,out_id) values('".getValidDBString($point_log_id)."','".getValidDBString($member_arr[$i])."',".$form["setPointM"].",'3',now(),'".getValidDBString($_SESSION["login_account_id"])."')";
                        $dbClass->Execute($sql);
                    }
                    $this->setNoticeMessage($smarty,"pointM|update");
                    return $this->INDEX($dbh,$smarty,$request);   
                 }elseif(isset($form["member_id"])&&$form["member_id"]!=""&&isset($form["point"])&&$form["point"]!=""&&strlen($form["point"])<6){
                    $point=$form["point"];
                    $member_id=$form["member_id"];
                    $sql="update t_member set point=point+(".$point.") where member_id='".getValidDBString($member_id)."' and status='4' and flg in ('1','2')";
                    $dbClass->Execute($sql);   
                    $sql_point="select point from t_member where member_id='".getValidDBString($member_id)."' and status='4' and flg in ('1','2')";
                    $res_point=$dbClass->SelectAllAssoc($sql_point);
                    $sql_id="select nextval('t_point_log_seq') as id ";
                    $res_id = $dbClass->SelectAllAssoc($sql_id);           
                    $point_log_id = $res_id[0]["id"];   
                    $sql="insert into t_point_log(point_log_id,member_id,point_change,type,created_at,out_id) values('".getValidDBString($point_log_id)."','".getValidDBString($member_id)."',".$point.",'3',now(),'".getValidDBString($_SESSION["login_account_id"])."')";
                    $dbClass->Execute($sql);   
                    $this->setNoticeMessage($smarty,"pointM|update");
                    return $this->INDEX($dbh,$smarty,$request);   
                 }else{
                    $jwvalid_res_t = array();
                    if((!isset($form["member_id"])||$form["member_id"]=="")&&(!isset($form["member_sel"])||empty($form["member_sel"]))){
                         $jwvalid_res_t ["member"]= array("errorid"=>"A");
                    }elseif((!isset($form["point"])||$form["point"]=="")&&(!isset($form["setPointM"])||$form["setPointM"]=="")){
                         $jwvalid_res_t ["point"]= array("errorid"=>"A");
                    }
                    $error_msg= $this->getErrorMsg("pointManagement_check",$jwvalid_res_t);
                }
                $smarty->assign("error_msg", @$error_msg);
                return $this->INDEX($dbh,$smarty,$request);   
            }ELSE{
                return $this->location('err.php');
            }
        }
      

  38.   

    岂不是所有的id都要划分,,有很多成员的,你看一下45楼。。整个步骤就是那样的。然后php里面要写判断好像
      

  39.   

    能把post过去的数据 输出出来 给我看看吗
      

  40.   

    这种事情本该是用 ajax 在浏览器中完成,而你现在是通过表单提交来刷新页面的
    那么,既然表单提交了多组数据,你就得分别对每组数据做检查即提示错误信息
    但你的代码中缺只对总体赋值了错误信息
      

  41.   

    有很多组数据呢。原本是这样的
    <td style="word-break: break-all; word-wrap:break-word;"><input type="text" name="<{$selList[loop].member_id}>_point" id="<{$selList[loop].member_id}>_point"maxlength="5" value="" style="ime-mode:disabled;margin-left:10px;margin-right:10px;width:80px"><b><{t}>pt<{/t}></b>
    <input type="button" name="btn_<{$selList[loop].member_id}>_point" id="btn_<{$selList[loop].member_id}>_point" value="<{t}>付与する<{/t}>" style="margin-left:10px;margin-right:10px" class="buttons" onclick="javascript:setpoint(this.id)">
    <{if $error_msg_point.point neq "" }><div class="err_warn"><{$error_msg_point.point}></div><{/if}>
    </td>然后加了个 <{assign var="memberid" value=$selList[loop].member_id|cat:"_point"}> 要在php里面对memberid进行判断,。应该是这样的
      

  42.   

    Array ( [point] => 给点数数请输入。 ) 
    Array ( [point] => 给点数数错误。 ) 
    这样的吗?这是print_r($error_msg); 
    打印出来的是没输入点数或者输入错误时候提示的