Kali ini kita akan membahas tentang bagaimana membuat form yang dinamis. Maksudnya jumlah element form bisa kita tambah dan kita kurangi dengan mudah. Screen shotnya seperti di atas, atau anda bisa melihat demo nya di sini. Form dinamis sangat berguna misalnya anda membuat data yang memiliki item item yang lebih detail.
I am trying to create an edit modal for each row in the database. My page looks like this.
When I click on the edit icon, I open a modal where a user's details can be edited. The modal looks like this.
The modal I intend to show is like this.
My view.php
How can I achieve the desired output?
jptl431jptl431
3 Answers
Something like this would suffice.
Note: I assume you are using bootstrap 4 for your project, although bootstrap 3 would work too, just tweak it a bit to suit your needs
Suggestion
I would recommend you to include the form in another blade view, render it with all the relevant data and then return it to the controller then show it in the modal.
Immortal DudeImmortal Dude
You can use the below code just pass the $data to the view and it will populate.
Anil Kumar SahuAnil Kumar Sahu
Easy and simple method.
Simply ensure your data-target and id values are dynamically changing with respect to the individual rows, in this case fix the modal box code into the loop that it takes the values dynamically. So since you are using Laravel you could do this:
![]()
RalphkayRalphkay
Not the answer you're looking for? Browse other questions tagged phplaravellaravel-5 or ask your own question.
To create dynamic and exciting sidebar menu, you need a database for the storage and website templates that facilitate in making the layout (In this article, I use adminLTE bootstrap, read my other tutorial here or check adminLTE official website for more information).
In this tutorial you will find information about creating and managing dynamic sidebar menu with mysql and adminLTE Bootstrap.
Table of Contents
Creating Table menu with myqsl for dynamic sidebar menu
Add new table in your database with name dynamic_menu , copy this table structure below to you
Or run this mysql script with include example menu
Explanation
Creating PDO Class to connect php and mysql
Create php file as pdo_db.php
$this->user='root';
$dns=$this->engine.':dbname='.$this->database.';host='.$this->host;
parent::__construct($dns,$this->user,$this->pass);
{
}
Creating dynamic sidebar menu in adminLTE Bootstrap Template
In adminLTE code, we will find code below to create sidebar menu
You can modify my code as you wish, if any question about how to create dynamic sidebar menu in adminLTE bootstrap, please leave comment ?
Comments are closed.
|
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |