I am using CodeIgniter, I have a form and fields are Name, Email, and Mobile
. I am using Jquery validation but validations are not working I am displaying the fields on the popup.
First I am displaying all the list in the table and there is an action button called as "Edit". If the user clicked on the edit button the popup will open with the respective data. In the popup, Validations are not working. Would you help me out on this issue?
I am using this code
<table id="list">
<thead>
<tr>
<th>Sr. No.</th>
<th>Name</th>
<th>Email</th>
<th>Mobile</th>
<th>Action</th>
</tr>
</thead>
<tbody>
<?php
if($MembershipList)
{
$n = 1;
foreach ($MembershipList as $rows)
{?>
<tr>
<td><?php echo $n++;?></td>
<td><?php echo $rows->name;?></td>
<td><?php echo $rows->email;?></td>
<td><?php echo $rows->mobileno;?></td>
<td>
<a href="javascript:void(0);" onclick="viewDetails(this)" data-id="<?php echo $rows->membership_id;?>">Edit</a></td>
</tr>
<!-- Modal -->
<div class="confirmation_alert" id="popup_verify-<?php echo $rows->membership_id;?>" style="display: none;">
<div class="opacity"></div>
<div class="profile_content p_v_popup">
<div class="profile_header clearfix">
<div class="profile_name_pic"> Edit details!!! </div>
</div>
<div class="profile_body">
<?php echo form_open('main_controller/editMember','class="editMember"'); ?>
<div class="col-lg-12 col-md-12">
<input type="text" name="name" value="<?php echo $rows->name;?>">
<input type="email" name="email" value="<?php echo $rows->email;?>">
<input type="text" name="mobileno" value="<?php echo $rows->mobileno;?>">
<input type="submit" name="send" value="SUBMIT">
</div>
<?php echo form_close(); ?>
</div>
</div>
</div>
<?php }}?>
</tbody>
</table>
JQuery validation
$('.editMember').each(function() {
$(this).validate({
// Specify the validation rules
rules: {
name:{
required: true
},
email:{
required: true,
email:true
},
mobileno:{
number:true,
minlength:10,
maxlength: 10
}
},
submitHandler: function(form) {
form.submit();
}
});
});
Let me know if require popup css. It's just normal popup.