검증과 오류
Validation error는 comment 아래의 question-local error area에 렌더링됩니다. Empty error container는 layout width/height를 차지하지 않아야 합니다.
Validation tag
<question type="single" name="Q1" required>
<description>Choose one option.</description>
<options>
<option value="1">One</option>
<option value="2">Two</option>
</options>
<validation>
if ($curr.o1) {
hardError("Option 1 is not allowed.");
}
</validation>
</question>
hardError(message)는 진행을 차단합니다. softError(message)는 one-time question-local message를 보여줍니다. Duplicate message는 normalized되어 한 번만 렌더링됩니다.
Error message catalog
Survey Link는 built-in respondent validation과 authored <validation> code에서 English default error catalog를 사용합니다. Validation code에서는 $errorMessages로 catalog를 호출할 수 있습니다.
hardError($errorMessages.minSelect, { min: 3 })
softError($errorMessages.maxRank, { max: 5 })
hardError("Choose {need} more option(s).", { need: 2 })
hardError(messageOrDescriptor, params?)는 진행을 차단합니다. softError(messageOrDescriptor, params?)는 one-time question-local message를 렌더링합니다. {param} placeholder는 message dedupe 전에 치환됩니다.
주요 catalog key는 아래와 같습니다.
| Key | Default message |
|---|---|
required | Please answer this question. |
openEndedRequired | Please enter text for the selected option. |
minSelect / maxSelect | Select at least/at most `{min |
minRank / maxRank | Rank at least/at most `{min |
invalidOption | The selected option is no longer available. |
numericRequired | Please enter a numeric value. |
dateRangeRequired | Please select a start and end date. |
Custom HTML controls
Mixed DSL + Custom HTML은 일반 React Survey Link flow 안에서 렌더링됩니다. DSL block 사이의 연속 raw HTML fragment는 divider page 기준 custom block으로 구성됩니다. Native input, select, textarea 값은 name attribute 기준으로 응답에 captured됩니다.
<question type="single" name="Q1">
<description>Choose one.</description>
<option value="1">One</option>
</question>
<div class="custom-note">
<label>Explain briefly
<textarea name="RAW_EXPLAIN" required minlength="5"></textarea>
</label>
</div>
<divider />
Survey content를 <form> tag로 감싸면 안 됩니다. Vibe Survey가 respondent form runtime을 소유합니다. required, min, max, minlength, pattern 같은 native HTML validation attribute는 Next/Complete를 차단하고 custom-block-local error로 렌더링됩니다.
TEST Audit Mode
TEST link의 Runtime Tools에는 Audit Mode toggle이 있습니다. Audit Mode는 QA를 위해 question name, question type, option code, attribute code, group name, semantic left/right를 compact하게 표시합니다. Option/attribute/group/left/right code는 별도 badge가 아니라 label 앞 inline prefix로 렌더링되어 응답 UI 구조를 덜 가립니다. min/max/step/order/mode/display-style 같은 dense setting은 custom metadata hovercard에서 확인합니다. LIVE link에는 Audit Mode UI가 렌더링되지 않습니다.
Template Expression diagnostics
Template Expression runtime error는 TEST link console에 template-expression source로 표시됩니다. 동일한 source/question/message의 반복 오류는 중복 제거되어, 깨진 expression 하나가 console이나 Run generate 결과를 과도하게 채우지 않습니다.
평가된 dynamic attribute가 문항을 응답 불가능한 상태로 만들면 fallback 로그가 남습니다. 예를 들어 number 문항의 dynamic min이 max보다 커지면 해당 render에서 충돌 bound를 제거해 respondent flow를 계속 가능하게 하고, Run generate diagnostics에도 같은 fallback을 한 번만 기록합니다.