我有包含下拉列表和复选框的ui。根据下拉列表选择值,我想与isnesd字段进行比较(它是数据库中的另一个字段),根据我想要的比较复选框只读字段。
查看:
<!-- Asset Type -->
<div class="form-group {{ $errors->has('asset_type_id') ? ' has-error' : '' }}">
<label for="asset_type_id" class="col-md-3 control-label">@lang('admin/assetdetails/form.type')</label>
<div class="controls col-md-7">
<div class="field-box">
{{ Form::select('asset_type_id',$assettype_list, Input::old('asset_type_id'), array('class'=>'select2', 'onchange' => 'check(this.value)' ,'style'=>'width:350px')) }}
{{ $errors->first('asset_type_id', '<span class="alert-msg"><i class="icon-remove-sign"></i> :message</span>') }}
</div>
</div>
</div>
<!-- NESD -->
<div class="form-group {{ $errors->has('nesd') ? 'error' : '' }}">
<label for="nesd" class="col-md-3 control-label">@lang('admin/assetdetails/form.nesd')</label>
<div class="controls col-md-7">
<input class="col-md-1 controls isnesdbox" type="checkbox" name="nesd" id="nesd" value="1" {{ $assetdetail->nesd === '1' ? 'checked' : '' }} />
{{ $errors->first('nesd', '<span class="alert-msg"><i class="icon-remove-sign"></i> :message</span>') }}
</div>
</div>
控制器:
public function getCreate()
{
$location_list = array('' => '') + Location::lists('name', 'id');
$assettype_list = array('' => '') + Assettype::lists('asset_type', 'id');
// Show the page
$assetdetail_options = array('0' => 'Top Level') + Assetdetail::lists('asset_number','id');
return View::make('backend/assetdetails/edit')->with('assetdetail_options',$assetdetail_options)->with('assetdetail',new Assetdetail)->with('location_list',$location_list)->with('assettype_list',$assettype_list);
}