PHP - Help W/onblur
I'm trying to use js function to: upon entering "paidamt" change the "amtdue",
"prevbal",auto-insert the current date(datepaid), change"pd", and increment the "checkno". I had this working at one time but memory precludes the use of the onblur. The following code displays all values for selected record from database and only updates "paidamt". Any help? echo "<tr> <td><input type='text' readonly size=15 name='acctno' value='" . $row['acctno'] . "' ></td> <td><input type='text' readonly size=25 name='bname' value='" . $row['bname'] . "'></td> <td><input type='text' readonly size=25 name='purpose' value='" . $row['purpose'] . "'></td> <td><input type='text' size=7 id='paidamt' name='paidamt' value='" . $row['paidamt'] ."' onBlur='calculate_paid(this)'></td> <td><input type='text' size=5 name='amtdue' value='" . $row['amtdue'] . "' ></td> <td><input type='text' size=5 name='prevbal' value='" . $row['prevbal'] . "' ></td> <td><input type='text' size=5 name='datepaid' value='" . $row['datepaid'] . "' ></td> <td><input type='text' size=5 name='pd' value='" . $row['pd'] . "' ></td> <td><input type='text' size=5 name='checkno' value='" . $row['checkno'] . "' ></td> </tr>"; function $_(IDS) { return document.getElementById(IDS); } function calculate_paid() { var recur = parseInt(document.getElementById("recur").value; var pd = parseInt(document.getElementById("pd").value; var shipamt = parseFloat(document.getElementById("shipamt").value; var paidamt = parseFloat(document.getElementById("paidamt").value; var prevbal = parseFloat(document.getElementById("prevbal").value; var amtdue = parseFloat(document.getElementById("amtdue").value; var checkno = parseInt(document.getElementById("checkno").value; var datepaid = parseFloat(document.getElementById("datepaid").value; var dateNow = new Date(); var dayNow = dateNow.getDate(); var datePaid = (dateNow.getMonth()+1)+"/"+dateNow.getDate()+"/"+dateNow.getFullYear(); datepaid.value = datePaid; prevbal.value = parseFloat(amtdue.value) + parseFloat(shipamt.value) - parseFloat(paidamt.value); amtdue.value = parseFloat(amtdue.value) + parseFloat(shipamt.value) - parseFloat(paidamt.value); checkno.value = parseInt(checkno.value) + "1"; if(recur.value=="N") {prevbal.value= amtdue.value;} if(prevbal.value=="0.00") {pd="P";} if(amtdue.value=="0.00") {pd="P";} Similar TutorialsHello all. I have an ID Messaging system where the user puts in the ID of the user they want to contact and it sends a message to their Inbox - Great. What I need is a feature where the user puts in the ID and onblur another textbox populates with the users Name from the MySQL Database without having to reload the page so they know they have the right person. I am pretty new to this so have no idea where to start with this population feature. Here's my form code. Hope someone can help. <table width="450" border="0"> <tr> <td> <form name="messages" method="post" action="inbox_messages_send.php" onsubmit="return checkform(this);"> <table width="411" height="227" border="0"> <tr> <td align="right" bgcolor="#EAEAEA"><font size="2" face="Arial, Helvetica, sans-serif">From:</font></td> <td bgcolor="#EAEAEA"><input type="hidden" name="sentBy" size="3" maxlength="3" align="absmiddle" value="<?php echo $_SESSION['member_ID']; ?>"> <input type="hidden" name="fname" value="<?php print email('name'); ?>"><input type="hidden" name="lname" value="<?php print email('lname'); ?>"> <font size="1" face="Arial, Helvetica, sans-serif">(Your ID is automatically attached)</font></td> </tr> <tr> <td align="right" bgcolor="#EAEAEA"><font size="2" face="Arial, Helvetica, sans-serif">To:</font></td> <td bgcolor="#EAEAEA"><input type="text" name="L_ID" size="3" maxlength="3" align="absmiddle"> <font size="1" face="Arial, Helvetica, sans-serif">(Member's ID)</font></td> </tr> <tr> <td align="right" bgcolor="#EAEAEA"><font size="2" face="Arial, Helvetica, sans-serif">Subject:</font></td> <td bgcolor="#EAEAEA"><input type="text" name="subject"></td> </tr> <tr> <td align="right" bgcolor="#EAEAEA"><font size="2" face="Arial, Helvetica, sans-serif">Message:</font></td> <td bgcolor="#EAEAEA"><textarea cols="35" rows="5" name="email_message"></textarea></td> </tr> <tr> <td align="right"> </td> <td><input type="submit" name="message" value="Send Message"></td> </tr> </table> </form></td> </tr> </table> |