2016-12-20 3 views
0

tr을 테이블에서 삭제 한 후 제출 버튼이 비활성화됩니다. 나는 bootststrap 유효성 검사를 사용하고 난 불을 지르고에서이 오류를 얻고있다 :tr 삭제 후 제출 버튼 비활성화 됨

enter image description here

그것은 나에게

유형의 오류 없음을주고하는 것은 정의되지 않습니다.

작업에서 삭제 버튼을 클릭하면 tr이 성공적으로 제거되지만 나머지 입력란을 채우고 제출 버튼을 클릭하면 제출 버튼이 비활성화됩니다.

<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12 "> 
    <div class="row"> 
     <div class="table-class" id="specialTemplate"> 
      <table class="table table-bordered"> 
       <thead> 
        <tr style="text-align: center;"> 
         <td style="width:15%">Services</td> 
         <td style="width:15%">Duration</td> 
         <td style="width:15%">Last Price </td> 
         <td style="width:15%">Discount Price </td> 
         <td style="width:15%">Actual Price</td> 
         <td style="width:15%">Action </td> 
        </tr> 
       </thead> 
       <tbody class="appendSpecial"> 
        <?php $duration = array("10mins","20mins","30mins","45mins","1hr","1hr-15mins","1hr-30mins","1hr-45mins","2hrs","3hrs"); ?> 
               @foreach($specialoffers as $key=> $alloffers) 
        <tr id="s-tr-{{ $alloffers['id'] }}"> 
         <input type=hidden name="id[]" value="{{ $alloffers['id'] }}"> 
         <td id="s-td-{{$alloffers['id'] }}" >{{ $alloffers['s_name'] }}</td> 
         <td> 
          <div class="time-class"> 
           <div class="form-group"> 
            <select class="select-class" name="s_duration[]"> 
             <option value="">Select</option> 
                   @foreach($duration as $value) 

             <option>{{$value }}</option> 
                   @endforeach 
            </select> 
           </div> 
         </div> 
        </td> 
        <td> 
         <div class="form-group"> 
          <input class="form-control" type="text" name="s_lastprice[]" placeholder="Price" > 
         </div> 
        </td> 
        <td> 
         <div class="form-group"> 
          <input class="form-control" type="text" name="s_discount[]" placeholder="Discount Price" > 
         </div> 
        </td> 
        <td> 
         <div class="form-group"> 
          <input class="form-control" type="text" name="s_actual[]" placeholder="Actual Price"> 
         </div> 
        </td> 
        <td> 
         <div class="btn-del-edit"> 
          <button type="button" rel="{{$alloffers['id'] }}" class="btn btn-info btn-edit getSpecial" data-toggle="modal" data-target="#myModal-specialedit"><i class="fa fa-pencil" aria-hidden="true"></i></button> 
          <button type="button" id="delete-{{ $alloffers['id'] }}" class="btn btn-danger btn-del deleteSpecial"><i class="fa fa-times" aria-hidden="true"></i></button> 
         </div> 
        </td> 
       </tr> 
     @endforeach 
      </tbody> 
     </table> 
    </div> 
    </div> 
</div> 

그리고 내 jQuery를하고 AJAX : 제출 '버튼을 UI에

$(document).on('click','.deleteSpecial', function(){ 
    var tdid = $(this).attr('id'); 
    var special = tdid.split('-'); 
    var id = special[1]; 
    $.ajax({ 
     type:"POST", 
     url: "delete-special-offer", 
     data: { id :id }, 
     success:function(resp){ 
      if($.trim(resp) == "success"){ 
       alert("Deleted Successfully!"); 
       var $template = $('#specialTemplate'), 
       $clone = $template 
       $('#sellerProfile') 
       .formValidation('addField', $clone.find('[name="s_lastprice[]"]')) 
       .formValidation('addField', $clone.find('[name="s_discount[]"]')) 
       .formValidation('addField', $clone.find('[name="s_actual[]"]')) 
       .formValidation('addField', $clone.find('[name="s_duration[]"]')) 
       $("#s-tr-"+id).remove(); 
      } 
      else{ 
       alert("failed"); return false; 
      } 
     } 
    }); 
}); 

답변

0

가 작동하지

enter image description here

여기 내 HTML입니다. 당신은 단순히 $("#s-tr-"+id).remove();.을 사용할 수 있습니다 삭제하려면 그래서 당신은 아래의 일을하고 싶은 : -

 var $template = $('#specialTemplate'), 
     $clone = $template 
     $('#sellerProfile') 
     .formValidation('addField', $clone.find('[name="s_lastprice[]"]')) 
     .formValidation('addField', $clone.find('[name="s_discount[]"]')) 
     .formValidation('addField', $clone.find('[name="s_actual[]"]')) 
     .formValidation('addField', $clone.find('[name="s_duration[]"]')) 

콘솔 로그에 따라, 그것은 오류가 양식 유효성 검사에 보여주기 때문에이

+0

양식의 버튼이 작동하지 않습니다 제출 실패 – kunal