幫助我在必填字段上假設(shè)在空時(shí)會改變顏色,如下所示:當(dāng)提交表單后出現(xiàn)必填字段時(shí), course_id 和grade_id 的下拉菜單應(yīng)變?yōu)榧t色。這是我用來創(chuàng)建過去教育表格的表格。form_modal.blade.php: <div class="form-group required"> <label class="col-lg-2 control-label">{{ msg('lbl_institute') }}</label> <div class="col-lg-4"> {!! Form::dropdown('institution_id', $institution, @$pasteducationinfo['institution_id'],'class="select2-form institution_id"') !!} </div> </div> <div id="institution" class="form-group hide"> <label class="col-lg-2 control-label">{{ msg('lbl_institute') }}</label> <div class="col-lg-4"> <input type="text" name="institution_name" class="form-control" value="{{ @$pasteducationinfo['institution_name'] }}" placeholder="SMK Cyberjaya"> </div> </div> @if(!empty($edulevelinfo['is_course_able'])) <div class="table-responsive repeater"> <table id="courseassessmentnew-table" class="table table-striped b-t b-b" data-repeater-list="pasteducation"> <thead> <th>{!! msg('lbl_course') !!}</th> <th>{!! msg('lbl_grade') !!}</th> <th></th> </thead> <tbody> @if(!empty($pasteducationdetailinfo)) @foreach($pasteducationdetailinfo as $detailinfo) @if (!empty($detailinfo->educationCourse->is_mandatory)) <tr> <td> {!! $educourseselection[$detailinfo['course_id']] !!} <input type="hidden" name="course_id[]" value="{{ @$detailinfo['course_id'] }}"> </td> <td> {!! Form::dropdown('grade_id[]', $gradeselection, $detailinfo['grade_id'],'class="select2-form"') !!} </td> <td></td> </tr> @else
2 回答

汪汪一只貓
TA貢獻(xiàn)1898條經(jīng)驗(yàn) 獲得超8個贊
如果您使用 Laravel 驗(yàn)證,這將對您有所幫助。
添加@error("input-name") is-invalid @enderror您的輸入類。
并顯示錯誤消息:
@error('email')
<span class="invalid-feedback" role="alert">
<strong>{{ $message }}</strong>
</span>
@enderror
如果有任何錯誤,它會顯示為,

慕后森
TA貢獻(xiàn)1802條經(jīng)驗(yàn) 獲得超5個贊
從 Bootstrap 4 => https://getbootstrap.com/docs/4.0/components/forms/?#validation
您需要is-valid
在institution_id
下拉列表中添加類
- 2 回答
- 0 關(guān)注
- 120 瀏覽
添加回答
舉報(bào)
0/150
提交
取消