මචන් මම Laravel 8 පාවිච්චි කරල web app එකක් හදනවා. ඒකෙ pop up box එකක් ඕපන් වෙලා selection box එකක් ඇතුලෙ options කිහිපයක් තියේ, ඒ options populate වෙන්නෙත් database එකකින්. මට ඕන එක එක option එක select කරනකොට popup එකේම table එකක ඒ option එකේ key එකට අදාලව database එකේ තියන fields ටිකක් පෙන්නන්න page එක reload නොවී.
මේ තියෙන්නෙ selection box එකේ කෝඩ් එක. වෙන controller function එකක වගේ කෝඩ් කොටසක් ඕනනම් කියන්න මම thread එක update කරන්නම්.
popup එකේ screenshot එකක් තමයි පහළ තියෙන්නෙ.
dynamically populate වෙන්න ඕන මේ විදිහට, test data ටිකක් තියෙන්නෙ
ලොකු උදව්වක් guys ගොඩ දාගන්න හෙල්ප් එකක් දුන්නොත්ත්.
මේ තියෙන්නෙ selection box එකේ කෝඩ් එක. වෙන controller function එකක වගේ කෝඩ් කොටසක් ඕනනම් කියන්න මම thread එක update කරන්නම්.
PHP:
<div id="UpgradeStudentModal" class="modal fade" tabindex="-1" aria-labelledby="myModalLabel"
aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title mt-0" id="myModalLabel">Upgrade Student</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal"
aria-label="Close"></button>
</div>
<div class="modal-body">
<form action="" method="post" enctype="multipart/form-data">
{{csrf_field()}}
<div class="mb-3">
<label for="" class="form-label">Teacher</label>
<select class="form-control" name="teacherId">
@foreach($teachers as $teacher)
<option value="{{$teacher->tId}}">{{$teacher->tName}}</option>
@endforeach
</select>
</div>
<div class="modal-footer">
<button type="submit" class="btn btn-primary waves-effect waves-light">Save
</button>
<button type="button" class="btn btn-outline-danger waves-effect waves-light"
data-bs-dismiss="modal">Close
</button>
</div>
</form>
</div>
</div>
</div>
</div>
popup එකේ screenshot එකක් තමයි පහළ තියෙන්නෙ.
dynamically populate වෙන්න ඕන මේ විදිහට, test data ටිකක් තියෙන්නෙ
ලොකු උදව්වක් guys ගොඩ දාගන්න හෙල්ප් එකක් දුන්නොත්ත්.