papajoejo86 Posted March 23, 2021 Share Posted March 23, 2021 i have two tables Loan Application table and Loans table. There is status option and date loan was applied section. After status has been chosen as Pending from the dropdown field and date chosen and loan application saved, it goes under the loans section. Now, admin has to go and approve the loan and pick the date the loan was approved under the loans section but date can be chosen for the approved date but the status cant be changed to approve because it shows pending. Please what can i do so when i select the date for approval , the status should change to approved automatically Quote Link to comment https://forums.phpfreaks.com/topic/312365-two-different-tables-and-linking-fields/ Share on other sites More sharing options...
Barand Posted March 23, 2021 Share Posted March 23, 2021 17 minutes ago, papajoejo86 said: i have two tables Loan Application table and Loans table Are you talking about HTML tables on the screen or database tables? Quote Link to comment https://forums.phpfreaks.com/topic/312365-two-different-tables-and-linking-fields/#findComment-1585301 Share on other sites More sharing options...
papajoejo86 Posted March 23, 2021 Author Share Posted March 23, 2021 please, i am talking about database tables Quote Link to comment https://forums.phpfreaks.com/topic/312365-two-different-tables-and-linking-fields/#findComment-1585303 Share on other sites More sharing options...
Barand Posted March 23, 2021 Share Posted March 23, 2021 When the admin adds an approval date, update the date and status in your tables when saved. If you want immediately to alter the status display on screen, use a javascript onchange event on the date input to change the status to Approved. Quote Link to comment https://forums.phpfreaks.com/topic/312365-two-different-tables-and-linking-fields/#findComment-1585310 Share on other sites More sharing options...
Adamhumbug Posted March 23, 2021 Share Posted March 23, 2021 Something like this might be useful as a point to start with - this is jquery by the way $('#element').on('change', function(){ //do stuff }) Quote Link to comment https://forums.phpfreaks.com/topic/312365-two-different-tables-and-linking-fields/#findComment-1585311 Share on other sites More sharing options...
Barand Posted March 23, 2021 Share Posted March 23, 2021 Here's an example of the javascript pprocessing. (I don't know what your tables look like to give you an example of the update.) <!DOCTYPE html> <html> <head> <title>Example</title> <meta http-equiv="content-language" content="en"> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <!-- link to jquery functions --> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script> <script type='text/javascript'> $().ready( function() { $("#approved").change( function() { if ($(this).val() > '') $("#status").val("Approved") else $("#status").val("Pending") }) }) </script> </head> <body> Status<br> <input type='text' name='status' id='status' value='Pending'> <br><br> Date approved<br> <input type='date' name='approved' id='approved'> </body> </html> Quote Link to comment https://forums.phpfreaks.com/topic/312365-two-different-tables-and-linking-fields/#findComment-1585315 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.