HEX
Server: Apache/2.4.41 (Amazon) OpenSSL/1.0.2k-fips PHP/5.6.40
System: Linux ip-172-31-40-18 4.14.146-93.123.amzn1.x86_64 #1 SMP Tue Sep 24 00:45:23 UTC 2019 x86_64
User: apache (48)
PHP: 5.6.40
Disabled: NONE
Upload Files
File: //var/www/html/pmw24/app/application/views/admin/customer/edit.php
<style>
    em.form_validation_error{
        color: #f00;
        font-size: 13px;
        text-align: left;
        position: absolute;
        left: 14px;
    }
</style>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.4.1/js/bootstrap-datepicker.min.js"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.4.1/css/bootstrap-datepicker3.css"/>
 <script src="https://cdn.jsdelivr.net/jquery.validation/1.16.0/additional-methods.min.js"></script>
 <script src="<?php echo base_url()?>/public/validation/js/jquery.validate.js"></script>
<!-- Content Wrapper. Contains page content -->
      <div class="content-wrapper">
        <!-- Content Header (Page header) -->
        <section class="content-header">
          <h3>
            Edit Customer 
            
          </h3>         
        </section>

        <!-- Main content -->
        <section class="content"> 
			<div class="row">
				<!-- general form elements -->
				<div class="col-md-12">
					  <div class="box box-primary">
					  <div class="admin-tab-wrapper">
						<div class="admin_tab">
							<!--<button class="btn btn-primary dropdown-toggle btn-algnmt" type="button" data-toggle="dropdown">Action
							<span class="caret"></span></button>-->
							<ul>							 
			          		  <li><a href="<?php echo base_url('admin/customer');?>">Back</a></li>	 
							</ul>
						</div>
					</div>
						<div class="box-header with-border">
						  <h3 class="box-title"></h3>
						  <?php if($this->session->flashdata('error_msg')){?>
							<div class="alert alert-warning alert-dismissible hite" style="height:60px;">
								<button aria-hidden="true" data-dismiss="alert" class="close" type="button">×</button>
								<h4><i class="icon fa fa-warning"></i><?php echo $this->session->flashdata('error_msg'); ?></h4>
							</div>
						  <?php }?>
						  <?php if($this->session->flashdata('success_msg')){?>
							<div class="alert alert-success alert-dismissible hite" style="height:60px;">
								<button aria-hidden="true" data-dismiss="alert" class="close" type="button">×</button>
								<h4><i class="icon fa fa-warning"></i><?php echo $this->session->flashdata('success_msg'); ?></h4>
							</div>
						  <?php }?>
						</div>
						<!-- /.box-header -->
						<!-- form start -->
						<form id="signupForm" role="form" class="mtbresize" method="post" action="<?php echo base_url('admin/customer/edit_customer');?>" enctype="multipart/form-data" autocomplete="off">
						  <div class="box-body">							
							<div class="form-group">
							    <label for="customer_type">Customer Type<sup class="superr">*</sup></label><br>
                                    
                                    <input class="customer_type_cls" type="radio" id="customer_type_I" name="customer_type" value="I" <?=($customer_data['customer_type']=='I')?'checked':''?>>
                                    <label for="customer_type_I">Individual</label>
                                    
                                    <input class="customer_type_cls" type="radio" id="customer_type_B" name="customer_type" value="B" <?=($customer_data['customer_type']=='B')?'checked':''?>>
                                    <label for="customer_type_B">Business</label>
                                <?php echo form_error('customer_type','<span class="error">', '</span>'); ?>
                            </div>
                            <div id="business_name_div" class="form-group" style="<?=($customer_data['customer_type']=='B')?'display:block;':'display:none;'?>">
							  <label for="business_name">Business Name<sup class="superr">*</sup></label>
							  <input type="text" class="form-control" id="business_name" name="business_name" value="<?php echo $customer_data['business_name']; ?>" placeholder="Business Name">
							  <?php echo form_error('business_name','<span class="error">', '</span>'); ?>
                            </div>
							<div class="form-group">
							  <label for="first_name">First Name<sup class="superr">*</sup></label>
							  <input type="text" class="form-control" id="first_name" name="first_name" value="<?php echo $customer_data['first_name']; ?>" placeholder="First Name" required="required">
							  <?php echo form_error('first_name','<span class="error">', '</span>'); ?>
                            </div>
                            <div class="form-group">
							  <label for="middle_name">Middle Name</label>
							  <input type="text" class="form-control" id="middle_name" name="middle_name" value="<?php echo $customer_data['middle_name']; ?>" placeholder="Middle Name">
							  <?php echo form_error('middle_name','<span class="error">', '</span>'); ?>
							</div>
							<div class="form-group">
							  <label for="last_name">Last Name<sup class="superr">*</sup></label>
							  <input type="text" class="form-control" id="last_name" name="last_name" value="<?php echo $customer_data['last_name']; ?>" placeholder="Last Name" required>
							  <?php echo form_error('last_name','<span class="error">', '</span>'); ?>
                            </div>

                            <div class="form-group">
							  <label for="email">Email<sup class="superr">*</sup></label>
							  <input type="email" class="form-control" id="email" name="email" value="<?php echo $customer_data['email'];?>" placeholder="Email" required="required">
							  <?php echo form_error('email','<span class="error">', '</span>'); ?>
                            </div>
                            
                            <div class="form-group">
							  <label for="abn">ABN</label>
							  <input type="text" class="form-control" id="abn" name="abn" value="<?php echo $customer_data['abn']; ?>" placeholder="ABN">
							  <?php echo form_error('abn','<span class="error">', '</span>'); ?>
                            </div>
                            
                            <div class="form-group">
							  <label for="landline_no">TELEPHONE (HOME)</label>
							  <input type="text" class="form-control" id="landline_no" name="landline_no" value="<?php echo $customer_data['landline_no']; ?>" placeholder="TELEPHONE (HOME)">
							  <?php echo form_error('landline_no','<span class="error">', '</span>'); ?>
							</div>                                                  
							
                            <div class="form-group">
							  <label for="mobile">Mobile No<sup class="superr">*</sup></label>
							  <input type="text" class="form-control" id="mobile" name="mobile" value="<?php echo $customer_data['mobile'];?>" placeholder="Mobile" required="required">
							  <?php echo form_error('mobile','<span class="error">', '</span>'); ?>
							</div>
                            
                            <div class="form-group">
							  <label for="flat_no">Unit/Flat No.</label>
							  <input type="text" class="form-control" id="flat_no" name="flat_no" value="<?php echo $customer_data['flat_no'];?>" placeholder="Unit/Flat No.">
							  <?php echo form_error('flat_no','<span class="error">', '</span>'); ?>
							</div>
							<div class="form-group">
							  <label for="street_no">Street No.</label>
							  <input type="text" class="form-control" id="street_no" name="street_no" value="<?php echo $customer_data['street_no'];?>" placeholder="Street No.">
							  <?php echo form_error('street_no','<span class="error">', '</span>'); ?>
                            </div>
                            
                            <div class="form-group">
							  <label for="street_name">Street Name</label>
							  <input type="text" class="form-control" id="street_name" name="street_name" value="<?php echo $customer_data['street_name'];?>" placeholder="Street Name">
							  <?php echo form_error('street_name','<span class="error">', '</span>'); ?>
							</div>
                            
                            <div class="form-group">
							  <label for="suburb">Suburb</label>
							  <input type="text" class="form-control" id="suburb" name="suburb" value="<?php echo $customer_data['suburb'];?>" placeholder="Suburb">
							  <?php echo form_error('suburb','<span class="error">', '</span>'); ?>
                            </div>
                            
                            <div class="form-group">
							  <label for="state">State</label>
							  <input type="text" class="form-control" id="state" name="state" value="<?php echo $customer_data['state'];?>" placeholder="State">
							  <?php echo form_error('state','<span class="error">', '</span>'); ?>
							</div>
							
							<div class="form-group">
							  <label for="pin">PostCode<sup class="superr">*</sup></label>
							  <input type="text" class="form-control" id="pin" name="pin" value="<?php echo $customer_data['pin'];?>" placeholder="Post code">
							  <?php echo form_error('pin','<span class="error">', '</span>'); ?>
							</div>
							
						  </div>
						  <!-- /.box-body -->
						  <div class="box-footer">	
							<input type="hidden" id="customer_id" name="customer_id" value="<?php echo $customer_data['customer_id']; ?>">
							<button type="submit" class="btn btn-sm btn-primary">Submit</button>
						  </div>
						</form>
					  </div>
				</div>
          <!-- /.box -->
          </div><!-- /.row -->	
        </section><!-- /.content -->
      </div><!-- /.content-wrapper -->
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-show-password/1.0.3/bootstrap-show-password.min.js"></script>
<script>
    $( "#signupForm" ).validate({
        rules: {
            customer_type: "required",
            first_name: "required",
            email:"required",
            mobile: {required:true,number: true, minlength:10,maxlength:15}, 
			pin:{required:true,number: true, minlength:4,maxlength:4},
			abn:{number: true, minlength:11,maxlength:11},
			landline_no:{number: true, minlength:10,maxlength:15}
        },
        messages: {						
            mobile:{minlength:"Mobile should be 10 - 15 digits",maxlength:"Mobile should be 10 - 15 digits"},
			pin:{minlength:"Post Code should be 4 digits",maxlength:"Post Code should be 4 digits"},
			abn:{minlength:"Min length is 11 digit",maxlength:"Max length is 11 digit"},
			landline_no:{minlength:"Telephone (home) should be 10 - 15 digits.",maxlength:"Telephone (home) should be 10 - 15 digits."},
        },
        errorElement: "em",
          
    });

    $(".customer_type_cls").change(function(){
		if($(this).val()=='I'){
			$("#business_name_div").hide();
			$("#business_name").removeAttr('required');
		}else{
			$("#business_name_div").show();
			$("#business_name").attr('required',true);
		}
	})
</script>