Regd.updation of field into database.....Need help

Javascript coding ..

Moderators: egami, macek, gesf

Post Reply
joinnavdev
New php-forum User
New php-forum User
Posts: 13
Joined: Thu Feb 05, 2015 12:21 pm

Mon Oct 03, 2016 5:30 pm

Hi All,

Appreciate help with the below issue......I am trying to display the employee details & giving option to update the records also, everything is working fine but Joining Date display/changes are fine but records are not getting updated.

Please find the code below........
<form id="personal_info" name="personal_info" method="post" action="javascript:void(0);" enctype="multipart/form-data">
<input type="hidden" name="update_id" value="{$sm.res.id_employee}" id="upd_id">
<table border="0" width="95%" class="mrgtp0" align="center">
<td>Date of Birth:</td>
<td align="left">
<span class="detail">{if $sm.res.dob eq '0000-00-00'}NA{else}{$sm.res.dob|date_format:'%d-%m-%Y'}{/if}</span>
<span class="edit_detail">
<input type="text" name="dob" value="{if $sm.res.dob eq '0000-00-00'}{else}{$sm.res.dob|date_format:'%d-%m-%Y'}{/if}" id="dob" class="text"/>
</span>
</td>
</tr>
<tr>
<td>Joining Date:</td>
<td align="left">
<span class="detail">{if $sm.res.joined_date eq '0000-00-00'}NA{else}{$sm.res.joined_date|date_format:'%d-%m-%Y'}{/if}</span>
<span class="edit_detail">
<input type="text" name="joined_date" value="{if $sm.res.joined_date eq '0000-00-00'}{else}{$sm.res.joined_date|date_format:'%d-%m-%Y'}{/if}" id="joined_date" class="text"/>
</span>
</td>
</tr>

<span class="detail">
<input type="button" name="edit" value="Edit" onclick="editDetail();" class="login_btn">
</span>
<span class="edit_detail">
<input type="button" name="save" value="Save" onclick="saveEmployee();" class="login_btn">
</span>
</table>
</form>

<script type="text/javascript">
function saveEmployee(){
var res = personalInfo();
cShowActivity('1');
document.personal_info.action="##LBL_SITE_URL##index.php/employee/updateEmployee";
if(res){
document.personal_info.submit();
}else{
var res = personalInfo();
}
}
</script>

Appreciate the help in resolving the above issue.

Thanks,
Nick

Post Reply