Merge pull request #37 from arieeefajar/fix/assessment-form
fix(assessment-form): add description in input value parameter
This commit is contained in:
commit
195a91e9f7
|
@ -1,2 +1,9 @@
|
|||
var landField = document.getElementById("lahan-field");
|
||||
var landVal = new Choices(landField);
|
||||
|
||||
function showInfo(selectEl, id) {
|
||||
const infoElement = document.getElementById(id + "-info");
|
||||
const selectedOption = selectEl.selectedOptions[0];
|
||||
const description = selectedOption.getAttribute("data-desc");
|
||||
infoElement.innerText = description || "-";
|
||||
}
|
||||
|
|
|
@ -50,12 +50,16 @@
|
|||
<div class="mb-3">
|
||||
<label for="" class="form-label">{{ $indicator->name }}</label>
|
||||
<select name="{{ $indicator->id }}" class="form-control"
|
||||
id="{{ $indicator->id }}-field" required>
|
||||
id="{{ $indicator->id }}-field" onchange="showInfo(this,{{ $indicator->id }})"
|
||||
required>
|
||||
<option value="" selected disabled>Pilih Jawaban</option>
|
||||
@foreach ($indicator->rules as $rule)
|
||||
<option value="{{ $rule->cf }}">{{ $rule->parameter_type }}</option>
|
||||
<option value="{{ $rule->cf }}" title="{{ $rule->description }}"
|
||||
data-desc="{{ $rule->description }}">
|
||||
{{ $rule->parameter_type }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
<small id="{{ $indicator->id }}-info" class="text-muted d-block mt-1"></small>
|
||||
<div class="invalid-feedback">
|
||||
Pilih Jawaban {{ $indicator->name }}
|
||||
</div>
|
||||
|
|
Loading…
Reference in New Issue