<div class="row form-group   ">
    <style>
        .txtarea { min-height:50px;}
    </style>
<?php 
$html = '';
$post = array();
       if(!Yii::app()->request->isPostRequest and !is_array($model->$fileField)){
				 
					$pTypes =  $model->faqList ;
					if(!empty($pTypes )){
					foreach($pTypes as $pos){
						$post['title'][] =  $pos->title;
						$post['file'][] =  $pos->file;
						 
					}
					}
					
					
					}
					else if(is_array($model->$fileField)){
					 
						$post = $model->$fileField;
						$model->$fileField =''; 
					}
					else{
					$post =  Yii::App()->request->getPost($fileField,array());
		}
      if(!empty($post)){ 
		 
		for($i= 0 ; $i< sizeOf($post['title']);$i++){
			$i_class = '';
				if(empty( $post['title'][$i]))
						{
							$i_class = 'error';
						
					}
			$html .= '<tr class="'; $html .= empty( $post['title'][$i]) ? 'textFields2 error' : '';  $html .='"><td><input type="text" class="form-control" name="'.$fileField.'[title][]" maxlength="150"  value="'.$post['title'][$i].'"   ></td><td><textarea  class="form-control txtarea" name="'.$fileField.'[file][]"  />'. $post['file'][$i].'</textarea></td><td  class="opt"><a href="javascript:remove()" class="text-center blk" data-id="'.$fileField.'" onclick="removeThisRow2(this)" ><i class="fa fa-remove"></i></a></td></tr>';
		};  
	  }


 ?>

 <div class="<?php echo !empty($model->$fileField) ? 'hidden' : '';?> browse_type row" id="abc_<?php echo $fileField;?>">
				
				<div class="col-sm-12" >
				    <h3 class="subheading_font">FAQ List </h3> 
				<div class="">
<table class="table table-bordered   <?php echo empty($html) ? 'hide' :'' ; ?>" style="margin-bottom:10px;" id="table_<?php echo $fileField ;?>" >
	<tr><th  width="35%">Question</th><th>Answer</th><th width="50px"  class="opt">Options</th></tr>
	<?php echo $html;?>
	<tr id="table_append_<?php echo $fileField;?>"><th colspan="100%" style="padding: 0px;" ></th></tr>
	
	</table>
	<?php echo $form->error($model,  $fileField );?> 
	</div>
				<?php echo $form->hiddenField($model,  $fileField , $model->getHtmlOptions( $fileField )); ?>
				</div>
				<div class="col-sm-12   "  >
					<div class="upload-btn-wrapper normal" style="width:200px;">
				 <button class="btn btn-info" onclick="addPropertyRow2()" style="height:50px !important" type="button"><?php echo $title_text;?></button>
				 </div>
				 	<div class="alert alert-info" style="width:50%;float: right;display:none !important">
			 
				</div>
				<div class="clearfix"><!-- --></div>
			 
				<script type="text/javascript">
				
				function addPropertyRow2(){
					$("#table_append_<?php echo $fileField;?>").closest('table').removeClass('hide');
					//alert($("#table_append_<?php echo $fileField;?>").closest('table').find('tr').length);
					$("#table_append_<?php echo $fileField;?>").before('<tr><td><input type="text"  placeholder="" class="form-control"  maxlength="150"   name="<?php echo $fileField;?>[title][]"/></td><td><textarea  class="form-control txtarea"  placeholder="" name="<?php echo $fileField;?>[file][]"></textarea></td><td class="opt"><a href="javascript:remove()" class="text-center blk" data-id="<?php echo $fileField;?>" onclick="removeThisRow2(this)" ><i class="fa fa-remove"></i></a></td></tr>')

				}
				
				
				</script>
				 
				<div class="clearfix"><!-- --></div> 
				   
				</div>
				</div>
				  
			  
                <div class="clearfix"><!-- --></div>
               
<script>
function removeThisRow2(k,){
	var ids = $(k).attr('data-id')
	$(k).parent().parent().remove();
	if($('#table_'+ids).find('tr').length==2){
	 
		$('#table_'+ids).addClass('hide');
	}
}
</script>
<div class="clearfix"></div>
</div>

