附加值未提取

时间:2019-05-14 11:37:48

标签: javascript php jquery append

附加了div的值没有进入控制器,但是附加的东西在视图页面上正确可见,并且我已经经历了几种方式,但是无法到达正确的位置。

这是我的查看部分,请看看

<script type="text/javascript">
   
   var maxAppends = 0;
   function add_field(id)
     {
      
    var update_new = $('<div class="form-group" style="margin-bottom: 0px">\n\
                      <label for="field-1" class="col-sm-4 control-label">Documentsss</label>\n\
                      <div class="col-sm-5">\n\
                      <div class="fileinput fileinput-new" data-provides="fileinput">\n\
                      <span class="btn btn-default btn-file"><span class="fileinput-new" >Select file</span><span class="fileinput-exists" >Change</span><input type="file" name="files[]" ></span> <span class="fileinput-filename"></span><a href="#" class="close fileinput-exists" data-dismiss="fileinput" style="float: none;">&times;</a></div></div>\n\<div class="col-sm-2">\n\<strong>\n\
                      <a href="javascript:void(0);" class="remCF"><i class="fa fa-times"></i>&nbsp;Remove</a></strong></div>');
                      

maxAppends++;


  $(".update_new_"+id).append(update_new);
 
  }
</script> 
<div class=" table-responsive div1" id="EmpprintReport">
                    <table id="myTable" class="table table-bordered table-striped table2excel">
                        <thead>
                        <tr>                        
                        <th>Document Name</th>
                        <th>Documents</th>
                        <th>Number</th>
                        <th>Expiry Date</th>
                        <th>Action</th>
                       </tr>
                    </thead>
                    <tbody>
                    
                      <?php
                      if(!empty($details))
                      {
                        foreach ($details as $value) {
                          ?>
                          <tr>
                          <td nowrap><?= $value->service_name;?></td>
                          <td nowrap>
                          <?php if (!empty($value->documents)): ?>
                            <div class="form-group">
                               <!--  <label class="col-sm-4 control-label"><?= ('Documents') ?>
                                    : </label> -->
                                <div class="col-sm-8">
                                    <?php
                                    $uploaded_file = json_decode($value->documents);

                                    if (!empty($uploaded_file)):
                                        foreach ($uploaded_file as $sl => $v_files):

                                            if (!empty($v_files)):
                                                ?>
                                                <p class="form-control-static">
                                                    <a href="<?php echo base_url() . 'uploads/documents/' . $v_files; ?>"
                                                       target="_blank"
                                                       style="text-decoration: underline;"><?= $sl + 1 . '. ' . ('view') . ' ' . ('other_document') ?></a>
                                                </p>
                                                <?php
                                            endif;
                                        endforeach;
                                    endif;
                                    ?>
                                </div>
                            </div>
                        <?php endif; ?> 
                          </td>
                          <td nowrap><?= $value->service_number;?></td>
                          <td nowrap><?= $value->expiry_date;?></td>
                          
                          <td>
                          <textarea id="<?php echo $value->id;?>" hidden> <?php echo $value->documents;?></textarea>
                            <a href="" data-toggle="modal" data-target="#edit_<?php echo $value->id;?>" id="Button3" id="Button3"  class="btn btn-sm btn-warning" style="margin-top:5px;">
           <i class="far fa-edit text-white" title="Edit"></i></a>
            <a data-toggle="modal" data-target="#confirm_delete"  name="delete" id="title" c-d-id="<?php echo $value->id;?>" clientid="<?= $id; ?>"  class="btn btn-sm btn-danger deletedocument" style="margin-top:5px;">
             <i class="fa fa-trash text-white" data-toggle="tooltip" data-placement="bottom" title="Delete"></i></a></td>



                          </tr>
                          <div class="modal fade edit" id="edit_<?php echo $value->id;?>" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" style="padding:20px !important;">
  
  <div class="modal-dialog modal-md" role="document">
    <div class="modal-content">
      <div class="modal-header">        
        <h4 class="modal-title" id="myModalLabel">Edit Document</h4>
        <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
      </div>
      <div class="modal-body">
        <?php
        $result=$this->Admin_model->get_services_by_id($value->id);
        //var_dump($value->id);
        ?>
          <form method="post" class="form_<?php echo $value->id;?>" action="<?php echo base_url();?>admin/edit-client-registration-details/<?= $value->id; ?>/<?= $id; ?>" enctype="multipart/form-data">
      
       <div class="form-group">
        <div class="control-group">
          <label>Service Name</label>
          <input type="text" name="service_name" class="form-control" placeholder="Enter service name" style="width: 100%" value="<?= $value->service_name; ?>" />  </div>
    
          <div class="control-group">
          <label>Number</label>
          <input type="text" name="service_no" class="form-control" placeholder="Enter number" style="width: 100%" value="<?= $value->service_number; ?>" />
          </div>

          <div class="control-group">
          <label>Expiry Date</label>
          <input type="text" name="date" id="date_<?= $value->id; ?>" class="form-control input-sm datepick" data-bind="datePicker: StartDate" value="<?= $value->expiry_date; ?>" />
          </div>

          <div id="update_new_<?php echo $value->id;?>" class="update_new_<?php echo $value->id;?> item-row">
                <div class="form-group mb0" style="margin-bottom: 0px">
                    <label for="field-1"
                           class="col-sm-4 control-label">Other Document</label>
                    <div class="col-sm-5">
                        <div class="fileinput fileinput-new" data-provides="fileinput">
                            <?php
                            if (!empty($value->documents)) {
                                $uploaded_file = json_decode($value->documents);
                            }
                            if (!empty($uploaded_file)):foreach ($uploaded_file as $v_files_image): ?>
                                <div class="">
                                    <input type="hidden" name="fileName[]"
                                           value="<?php echo $v_files_image ?>">
                                  
                                    <span class=" btn btn-default btn-file">
                                    <span class="fileinput-filename"> <?php echo $v_files_image ?></span>
                                    <a href="javascript:void(0);" class="remCFile" style="float: none;">×</a>
                                    </span>
                                    <strong>
                                        <a href="javascript:void(0);" class="RCF"><i
                                                class="fa fa-times"></i>&nbsp;Remove</a></strong>
                                    <p></p>
                                </div>

                            <?php endforeach; ?>
                            
                            <?php endif; ?>
                                <!-- Here i want the appended result and the result is coming but the values selected here is not passing to the controller while submitting-->
                            
                        </div>
                        <div id="msg_pdf" style="color: #e11221"></div>
                    </div>
                    <div class="col-sm-3">
                        <strong><a href="javascript:void(0);" id="update_more" onclick="add_field('<?php echo $value->id;?>');" u_id="<?php echo $value->id;?>" class="addCF item-row-click update_more"><i
                                    class="fa fa-plus"></i>&nbsp;Add More
                            </a></strong>
                    </div>
                </div>

                

            </div>

          

          
        </div>
      
      <div class="modal-footer">
         <img src="<?php echo base_url();?>assets/resources/ajax-loader.gif" id="ajaxIndicator" style="display: none; margin-right: 10px" />
                    <input type="submit" id="btnSubmit" class="btn btn-primary" style="font-weight: bold" value="Edit Details" />&nbsp;
        <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
        <!-- <button type="button" class="btn btn-primary">Save changes</button> -->
      </div>
      </form>
    </div>
  </div>
</div>
</div>
                          <?php
                        }
                      }
                      ?>
                        
                    </tbody>
                        <tfoot>
                          <tr>
                            <th></th>
                            <th></th>
                            <th></th>
                            <th></th>
                            <th></th>
                          </tr>
                        </tfoot>
                </table>

                  </div>

0 个答案:

没有答案