이단교단 기타 선택시 직접 입력 추가

This commit is contained in:
peregr1nus
2025-12-12 16:17:09 +09:00
parent 8ab14e951a
commit a3c8a6d738
2 changed files with 51 additions and 1 deletions

View File

@@ -42,6 +42,11 @@
</select> </select>
</div> </div>
<div class="form-group" id="cultOtherGroup" style="display: none;">
<label for="cult_other">이단교단 직접 입력 *</label>
<input type="text" id="cult_other" name="cult_other" value="{{ basic_info.get('cult_other', '') }}" placeholder="이단교단명을 입력해주세요">
</div>
<div class="form-actions"> <div class="form-actions">
<button type="submit" class="btn btn-primary">다음 단계</button> <button type="submit" class="btn btn-primary">다음 단계</button>
</div> </div>
@@ -51,9 +56,45 @@
{% block scripts %} {% block scripts %}
<script> <script>
// 이단교단 선택에 따라 직접 입력 필드 표시/숨김
document.getElementById('cult').addEventListener('change', function() {
const cultOtherGroup = document.getElementById('cultOtherGroup');
const cultOtherInput = document.getElementById('cult_other');
if (this.value === '기타 (위 선택지에 없을 경우)') {
cultOtherGroup.style.display = 'block';
cultOtherInput.required = true;
} else {
cultOtherGroup.style.display = 'none';
cultOtherInput.required = false;
cultOtherInput.value = '';
}
});
// 페이지 로드 시 초기 상태 설정
document.addEventListener('DOMContentLoaded', function() {
const cultSelect = document.getElementById('cult');
if (cultSelect.value === '기타 (위 선택지에 없을 경우)') {
document.getElementById('cultOtherGroup').style.display = 'block';
document.getElementById('cult_other').required = true;
}
});
document.getElementById('step1Form').addEventListener('submit', async function(e) { document.getElementById('step1Form').addEventListener('submit', async function(e) {
e.preventDefault(); e.preventDefault();
// '기타' 선택 시 직접 입력 필드 검증
const cultSelect = document.getElementById('cult');
const cultOtherInput = document.getElementById('cult_other');
if (cultSelect.value === '기타 (위 선택지에 없을 경우)') {
if (!cultOtherInput.value.trim()) {
alert('이단교단명을 직접 입력해주세요.');
cultOtherInput.focus();
return;
}
}
const formData = new FormData(this); const formData = new FormData(this);
const data = Object.fromEntries(formData); const data = Object.fromEntries(formData);

View File

@@ -47,8 +47,17 @@ class WordProcessor:
doc.add_paragraph('') # 빈 줄 doc.add_paragraph('') # 빈 줄
# 4. 네 번째 단락: [별첨3] 이단 상세 점검 (기타가 아닌 경우만) # 4. 네 번째 단락: [별첨3] 이단 상세 점검 (기타가 아닌 경우만)
# '기타' 선택 시 직접 입력한 이단명 사용
display_cult_name = cult_name
if cult_name == '기타 (위 선택지에 없을 경우)':
cult_other = basic_info.get('cult_other', '')
if cult_other:
display_cult_name = cult_other
else:
display_cult_name = '기타'
if cult_name and cult_name != '기타 (위 선택지에 없을 경우)' and specific: if cult_name and cult_name != '기타 (위 선택지에 없을 경우)' and specific:
self._add_section_title(doc, f'[별첨3] 이단 상세 점검 ({cult_name}) (각 문항에 대해 예, 아니오 또는 필요시 서술형으로 답변해 주시면 됩니다)') self._add_section_title(doc, f'[별첨3] 이단 상세 점검 ({display_cult_name}) (각 문항에 대해 예, 아니오 또는 필요시 서술형으로 답변해 주시면 됩니다)')
self._add_specific_cult_table(doc, specific, self.cult_questions) self._add_specific_cult_table(doc, specific, self.cult_questions)
# 기타의견 # 기타의견
if specific.get('other_opinions'): if specific.get('other_opinions'):