I have 2 forms, containing employee information that is readOnly=true
My second form contains, input box to replace and update the data inside the first form. My update is a link tag instead of button.
我有2个表单,包含readOnly = true的员工信息我的第二个表单包含,输入框用于替换和更新第一个表单中的数据。我的更新是链接标记而不是按钮。
1st Form
第一表格
<form class="secondtdr" name="updatein">
<h4 class="ua">Referrer Personal Information</h4>
<div class="referrerid">
<p align="left">Referrer ID</p>
<input type="text" name="cont" value="<?php echo $contact_no; ?>" readOnly="true">
</div>
<div class="empnum">
<p align="left">Employee Number</p>
<input type="number" name="cont" value="<?php echo $empid; ?>" readOnly="true">
</div>
2nd Form
第二表格
<form class="tabletoedit" method="post">
<br>
<div class="empnum">
<p align="left">Employee Number</p><br>
<input type="number" name="cont" value="">
</div>
<div class="fnamep">
<p align="left">Fullname</p>
<input type="text" name="cont" value="">
</div>
<div class="action_btns">
<div class="one_half">
<a href="javascript:document.forms['updatein'].submit()" class="upbtn" name="btnUpdate">Update</a>
</div>
</div>
</form>
1 个解决方案
#1
0
You can achieve it by writing some javascript codes,like this(codes below are not tested).
您可以通过编写一些javascript代码来实现它,如下所示(下面的代码未经过测试)。
<script>
function updateData()
{
document.getElementById('form1_employee_num').value = document.getElementById('employee_num').value;
...
//if you wan to update the new data to database,you can use AJAX
}
</script>
form 1
表格1
<form class="secondtdr" name="updatein">
<h4 class="ua">Referrer Personal Information</h4>
<div class="referrerid">
<p align="left">Referrer ID</p>
<input type="text" name="cont" value="<?php echo $contact_no; ?>" readOnly="true" id="form1_referrer_id">
</div>
<div class="empnum">
<p align="left">Employee Number</p>
<input type="number" name="cont" value="<?php echo $empid; ?>" readOnly="true" id="form1_employee_num">
</div>
form2
窗口2
<form class="tabletoedit" method="post">
<br>
<div class="empnum">
<p align="left">Employee Number</p><br>
<input type="number" name="cont" value="" id="employee_num">
</div>
<div class="fnamep">
<p align="left">Fullname</p>
<input type="text" name="cont" value="" id="fullname">
</div>
<div class="action_btns">
<div class="one_half">
<a href="javascript:void(0);" class="upbtn" name="btnUpdate" onclick="updateData();">Update</a>
</div>
</div>
</form>
#1
0
You can achieve it by writing some javascript codes,like this(codes below are not tested).
您可以通过编写一些javascript代码来实现它,如下所示(下面的代码未经过测试)。
<script>
function updateData()
{
document.getElementById('form1_employee_num').value = document.getElementById('employee_num').value;
...
//if you wan to update the new data to database,you can use AJAX
}
</script>
form 1
表格1
<form class="secondtdr" name="updatein">
<h4 class="ua">Referrer Personal Information</h4>
<div class="referrerid">
<p align="left">Referrer ID</p>
<input type="text" name="cont" value="<?php echo $contact_no; ?>" readOnly="true" id="form1_referrer_id">
</div>
<div class="empnum">
<p align="left">Employee Number</p>
<input type="number" name="cont" value="<?php echo $empid; ?>" readOnly="true" id="form1_employee_num">
</div>
form2
窗口2
<form class="tabletoedit" method="post">
<br>
<div class="empnum">
<p align="left">Employee Number</p><br>
<input type="number" name="cont" value="" id="employee_num">
</div>
<div class="fnamep">
<p align="left">Fullname</p>
<input type="text" name="cont" value="" id="fullname">
</div>
<div class="action_btns">
<div class="one_half">
<a href="javascript:void(0);" class="upbtn" name="btnUpdate" onclick="updateData();">Update</a>
</div>
</div>
</form>