Laravel-以创建形式检索旧值文本框

时间:2018-04-26 13:04:04

标签: css json database laravel-5.5 tex

我需要你的帮助,我已经创建了一个用于创建付费公告的表单和一个用于编辑的表单。我需要的是:

一旦我选择了emplyee_id,其他与文本字段相关的弹出窗口与来自DB的旧数据一起输入;如果没有,我给他们价值并提交。

我想知道如何在Laravel中做到这一点?

enter image description here

以下是代码create.blade.php

<form method="post" action="{{url('employeBultinDetails')}}">
    {{csrf_field()}}


    <div class="row">
      <div class="col-md-4"></div>
        <div class="form-group col-md-4">
          <label for="paie_id">Mois du paie:</label>
          <select id="paie_id" name="paie_id" class="form-control">
              @foreach($paies as $p)
                <option value="{{$p->id}}">{{$p->mois}} - {{$p->annee}}</option> 
              @endforeach
          </select>
        </div>
      </div>   

    <div class="row">
      <div class="col-md-4"></div>
        <div class="form-group col-md-4">
          <label for="employe_id"> Employee:</label>

          <select id="employe_id" name="employe_id" class="form-control">
          <option value="">Selectionner l'employé...</option>
            @foreach($employes as $emp)
              <option value="{{$emp->id}}">{{$emp->nni}} : {{$emp->nomComplet}}</option> 
            @endforeach
          </select>

        </div>
      </div>


    <div class="row">
      <div class="col-md-4"></div>
        <div class="form-group col-md-4">
          <table>
              <tr> 
                <th >Rubrique:</th> 
                <th >Montant:</th>
              </tr>

              @foreach($rubriques as $rub)
              <tr> 
                <td>{{$rub->libelle}}</td>

                <td>
                  <input type="text" class="form-control" name="montant[{{$rub->id}}]">
                </td>
              </tr>

              @endforeach
          </table>

        </div>
      </div> 

    <div class="row">
      <div class="col-md-4"></div>
      <div class="form-group col-md-4">
        <button type="submit"  class="btn btn-success" style="margin-left:38px">Enregistrer</button>
      </div>
    </div>
  </form>
@endsection

1 个答案:

答案 0 :(得分:0)

试试这段代码:

{
  "animations": [
    {
      "animationName": "CubeAction",
      "channels": [
        {
          "channelComponents": [
            {
              "channelComponentName": "Location X",
              "keyFrames": [
                {
                  "coords": [
                    0.0,
                    0.0
                  ],
                  "leftHandle": [
                    -0.39041149616241455,
                    0.0
                  ],
                  "rightHandle": [
                    0.39041149616241455,
                    0.0
                  ]
                },
                {
                  "coords": [
                    1.0,
                    0.0
                  ],
                  "leftHandle": [
                    0.6095885038375854,
                    0.0
                  ],
                  "rightHandle": [
                    1.4066786766052246,
                    0.0
                  ]
                },
                {
                  "coords": [
                    2.0416666666666665,
                    0.0
                  ],
                  "leftHandle": [
                    1.6349879900614421,
                    0.0
                  ],
                  "rightHandle": [
                    2.448345343271891,
                    0.0
                  ]
                }
              ]
            },
            {
              "channelComponentName": "Location Z",
              "keyFrames": [
                {
                  "coords": [
                    0.0,
                    -7.051087379455566
                  ],
                  "leftHandle": [
                    -0.39041149616241455,
                    -7.051087379455566
                  ],
                  "rightHandle": [
                    0.39041149616241455,
                    -7.051087379455566
                  ]
                },
                {
                  "coords": [
                    1.0,
                    -0.11975812911987305
                  ],
                  "leftHandle": [
                    0.6095885038375854,
                    -2.7274463176727295
                  ],
                  "rightHandle": [
                    1.4066786766052246,
                    2.596583843231201
                  ]
                },
                {
                  "coords": [
                    2.0416666666666665,
                    6.575384140014648
                  ],
                  "leftHandle": [
                    1.6349879900614421,
                    6.575384140014648
                  ],
                  "rightHandle": [
                    2.448345343271891,
                    6.575384140014648
                  ]
                }
              ]
            },
            {
              "channelComponentName": "Location Y",
              "keyFrames": [
                {
                  "coords": [
                    0.0,
                    0.0
                  ],
                  "leftHandle": [
                    -0.39041149616241455,
                    0.0
                  ],
                  "rightHandle": [
                    0.39041149616241455,
                    0.0
                  ]
                },
                {
                  "coords": [
                    1.0,
                    3.835103988647461
                  ],
                  "leftHandle": [
                    0.6095885038375854,
                    3.835103988647461
                  ],
                  "rightHandle": [
                    1.4066786766052246,
                    3.835103988647461
                  ]
                },
                {
                  "coords": [
                    2.0416666666666665,
                    -0.025578022003173828
                  ],
                  "leftHandle": [
                    1.6349879900614421,
                    -0.025578022003173828
                  ],
                  "rightHandle": [
                    2.448345343271891,
                    -0.025578022003173828
                  ]
                }
              ]
            }
          ],
          "channelName": "Location"
        }
      ]
    }
  ]
}