jeudi 6 février 2020

Set background-color to div from form in another blade

My project contains index.blade.php and create.blade.php. In create.blade.php is a form for creating divs that are listed in the index.blade.php, through the form I need to pass the background-color for each div made, options red, yellow and green color.

My create.blade.php code:

<form action="" method="post">
                        @csrf
                        <label for="name" style="padding-right:20px">Name</label>
                        <input type="text" id="name" name="name" style="padding-right:50px; margin-bottom:10px" placeholder="Name"><br>
                        <label for="supplier" style="padding-right:2px">Supplier</label>
                        <input type="text" id="supplier" name="supplier" style="padding-right:50px; margin-bottom:10px" placeholder="Supplier"><br>
                        <label for="type" style="padding-right:28.5px">Type</label>
                        <input type="text" id="type" name="type" style="padding-right:50px; margin-bottom:10px" placeholder="Type"><br>
                        <label for="url" style="padding-right:41.8px">Url</label>
                        <input type="text" id="url" name="url" style="padding-right:50px; margin-bottom:10px" placeholder="Url"><br>
                        <label for="color" >Color</label>
                        <select id="selector" name="color">
                            <option value="" disabled selected hidden>Please Choose...</option>
                            <option value="green">Green (ready for sale)</option>
                            <option value="yellow">Yellow (in progress)</option>
                            <option value="red">Red (new)</option>
                          </select>
                          <br>

                        <button type="submit" id="kreiraj_dugme_create" onclick="selectBackground()">Create</button>

And my index.blade.php code:

                                    @foreach ($warehouses as $key => $warehouse)
                                    <div class="brder1" draggable="true"  ondragstart="drag(event,)" id="">
                                        <h1 class="ime_palete"></h1> 
                                        <a class="link_palete" href="" target="_blank">Link</a>
                                        <a class="edit_palete" href="">Edit</a>
                                        <a class="show_pallet" href="">Show</a>
                                        <form action="" method="post">
                                            @csrf
                                            @method('DELETE')
                                            <button type="submit" class="izbrisiDugme" onclick="remove()">Remove</button>
                                        </form>
                                    </div>
                                    @endforeach

                                </div>
                                <a  class="create_palete" href="">Create</a>

All I need is to set background-color from options to div brder1



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire