이 설문지는 완벽하게 정상적으로 작동합니다. 난이 질문 하나만 바꿔 줘야 해. 기본적으로 Answers "Yes"및 "No"에 대한 두 개의 라디오 버튼과 그 아래에 텍스트 영역이 있습니다. 이제 사용자가 "예"라디오 버튼을 선택하지 않으면 텍스트 영역을 잠그고 싶습니다. 텍스트 영역에 "예"라는 이유를 입력 할 수 있습니다.라디오 버튼 텍스트 영역
나는이 기능을 둘러 보았지만 시도했지만 작동하지 않는 것 같습니다.
<script>
function validate() {
var radioYes = document.getElementById('radioYes');
var textarea = document.getElementById('question5comment');
if (radioYes.checked && question5comment.value.length < 1) {
alert('Please enter your reason for Question 5.');
question5comment.focus();
return false;
}
}
function toggle(value) {
document.getElementById('question5comment').disabled = value;
}
</script>
5. Are you using other non-franchise service centres?
<br>
*if yes is there any other reason you would do so other than price
<br>
<input type="radio" name="question5"
value="Yes" required>Yes
<br>
<input type="radio" name="question5"
<value="No" required>No
<br>
<textarea name="question5comment" rows="5" cols="40" required></textarea>
사실은 true와 false를 변경해야했습니다. 하지만 텍스트 영역에 아무 것도 입력하지 않고 시도하고 제출하는 경우에만 경고 메시지가 나타나기를 바랍니다. 가능한 선생님 이세요? –
예, 제출 처리기에서 값의 길이를 확인한 다음 예인 경우를 확인하십시오. –
완벽한 선생님은 모든 설정합니다. 마지막으로 나는 텍스트 영역을 기본적으로 잠글 수 있습니까? 그래서 양식이 열리면 텍스트 영역이 잠 깁니다. –