이단교단 기타 선택시 직접 입력 추가
This commit is contained in:
@@ -42,6 +42,11 @@
|
||||
</select>
|
||||
</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">
|
||||
<button type="submit" class="btn btn-primary">다음 단계</button>
|
||||
</div>
|
||||
@@ -51,9 +56,45 @@
|
||||
|
||||
{% block scripts %}
|
||||
<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) {
|
||||
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 data = Object.fromEntries(formData);
|
||||
|
||||
|
||||
@@ -47,8 +47,17 @@ class WordProcessor:
|
||||
doc.add_paragraph('') # 빈 줄
|
||||
|
||||
# 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:
|
||||
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)
|
||||
# 기타의견
|
||||
if specific.get('other_opinions'):
|
||||
|
||||
Reference in New Issue
Block a user