You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi Guys, iam working on project but iam currently faced with a challenge to implement OnChange event Javascript method in our code.
I do have two tables; One is for user registration and the other is for stage registration. The scenario is that i must add a user to a stage for which the user id is automatically fetched from the user table and easily adds to the AddUserToStage form, which is working well. However, iam supposed to select the name of the stage from the drop down select option list which displays stage name fetched dynamically from the database table(StageRegistration). The requirement is that when i select a stage name i would like to have other additionally corresponding textfields automatically fetch and fill their corresponding data from the database table(StageRegistration).
How do i do that? Any help is highly appreciated. Below is the sample code ian using;
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.7.1/jquery.min.js"></script>
<script>
$(document).ready(function(){
$('#stagename').change(function(){
// var stagename = $(this).val();
$.ajax({
// Change the link to the file you are using where the code resides
url: '/AddUserToStage.php',
dataType: 'json',
type: 'POST',
// This just sends the value of the dropdown
data: { stagename: $(this).val() },
success: function(response)
{
// Parse the jSON that is returned
// Using conditions here would probably apply
// incase nothing is returned
var Vals = JSON.parse(response);
// These are the inputs that will populate
$("input[name='stageID']").val(Vals.stageID);
$("input[name='stgcreation_date']").val(Vals.stgcreation_date);
$("input[name='stagelocation']").val(Vals.stagelocation);
$("input[name='stagechairperson']").val(Vals.stagechairperson);
$("input[name='stagechairpersonNIN']").val(Vals.stagechairpersonNIN);
$("input[name='stagechairpersoncontact']").val(Vals.stagechairpersoncontact);
$("input[name='stagevillage']").val(Vals.stagevillage);
$("input[name='stageparish']").val(Vals.stageparish);
$("input[name='stagedistrict']").val(Vals.stagedistrict);
}
});
});
});
</script>
The text was updated successfully, but these errors were encountered:
Hi Guys, iam working on a project form where by i would like to search for data from the mysql database using ID and then auto fill out the input textbox fields. Ihave tried to write up a code as seen below but failed to show corresponding data in the various form fields. Any Help is highly welcome. See code below:
Hi Guys, iam working on project but iam currently faced with a challenge to implement OnChange event Javascript method in our code.
I do have two tables; One is for user registration and the other is for stage registration. The scenario is that i must add a user to a stage for which the user id is automatically fetched from the user table and easily adds to the AddUserToStage form, which is working well. However, iam supposed to select the name of the stage from the drop down select option list which displays stage name fetched dynamically from the database table(StageRegistration). The requirement is that when i select a stage name i would like to have other additionally corresponding textfields automatically fetch and fill their corresponding data from the database table(StageRegistration).
How do i do that? Any help is highly appreciated. Below is the sample code ian using;
Code Sample:
Stage Members Dashboard
The text was updated successfully, but these errors were encountered: