I have a PHP page for insert, update and delete in which a pop up for edit is shown as follows
The pop is shown in jquery as follows when the edit button is clicked in the table in background of image shown according to the id:
$('.edit').live('click',function(){
var id=$(this).attr('data-id');
params={};
params.id=id;
params.action="editClient";
$('#popupbox').load('chapter_manager.php', params,function(){
$('#block').show();
$('#popupbox').show();
$(document).ajaxComplete(function(){
$("#wait").css("display", "none");
});
})
I need validation for the two input boxes. With jquery it works fine .
I need to perform server side validation .
The problem is that the page gets relaoded after the button click and hence the pop is not shown again after the server side validation.
I tried ajax but not working. Any idea how should I show the pop up again?
Also I want to know whether I need to perform PHP server side validation when already I have done validation in jquery?
I am using a page template in the modal pop up with the from submit and submit button as follows which is different from the page which is seen in the background.
<form name ="client" id="client" method="POST" action="chapter_manager.php"><div style="display: block; position:relative;" class="modal">
<div class="modal-dialog" style="width:100%; margin:0px 0px 0px 0px;">
<div class="modal-content">
<div class="modal-header">
<button id="close_form" type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h4 class="modal-title"> <?php echo $view->label ;?> </h4>
</div>
<div class="modal-body">
<table>
<tr><td><input type="hidden" name="id" id="id" value="<?php print $view->client->getChapter_ID() ?>"> <label>Name:</label>
<span style="color:#c30;">*</span>
<?php /*?><span class="error">* <?php echo $nameErr;?></span><?php */?>
<span class="error"> <?php echo $nameErr;?></span> </td>
<td><input type="text" class="form-control" name="name" id="name" value = "<?php print $view->client->getChapter_Name() ?>">
</td>
</tr>
<tr>
<td><br/>
</td>
<td></td>
</tr>
<tr>
<td><label>Description:</label>
<span style="color:#c30;">*</span> </td>
<td><input type="text" class="form-control" name="description" id="description" value = "<?php print $view->client->getChapter_Description() ?>">
</td>
</tr>
</table>
</div>
</div>
<div class="modal-footer">
<input id="cancel" class="btn btn-default pull-left" type="button" value ="Cancel" />
<input id="submit" class="btn btn-primary " type="submit" name="submit" value ="Save Changes" />
</div>
</div>
</div>
</div>
</div>
</form>