Laravel条件形式选择

时间:2017-05-07 07:31:23

标签: php laravel

我有一个表格中有两个相互连接的字段。模型为CityState,其中一个State可以包含更多Cities。我想设置我的表单,以便根据我选择的CitiesState进行过滤。这不起作用,因为它没有动态添加它。它的最佳方法是什么?

<div class="col-lg-6 col-md-6 col-sm-6 col-xs-6">
    <div class="form-group {{ $errors->has('state_id') ? 'has-error' : '' }}">
        <label for="state_id">Select State</label>
        {!! Form::select('state_id', $states, 'Select State',['class' => 'form-control','placeholder' => 'Select State']) !!}
    </div>
</div>

<div class="col-lg-6 col-md-6 col-sm-6 col-xs-6">
    <div class="form-group {{ $errors->has('city_id') ? 'has-error' : '' }}">
        <label for="city_id">Select City</label>
        {!! Form::select('city_id', $cities, 'Select City',['class' => 'form-control','placeholder' => 'Select City']) !!}
    </div>
</div>

0 个答案:

没有答案