Hi, I have a submission datapage which contains dropdown. The dropdown has 4 items in the list. If the item selected = "PAT" I want the checkbox (PAT_Test) to be automatically checked and disabled. The code I'm using doesn't check the checkbox. I'd be very grateful if someone could show me if there's an error and how to correct it.
You can post now and register later.
If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.
Question
RonAnderson
Hi, I have a submission datapage which contains dropdown. The dropdown has 4 items in the list. If the item selected = "PAT" I want the checkbox (PAT_Test) to be automatically checked and disabled. The code I'm using doesn't check the checkbox. I'd be very grateful if someone could show me if there's an error and how to correct it.
Here's the code I'm using:-
<script>
document.addEventListener('DataPageReady', function() {
document.getElementById("InsertRecordSurvey_Group_Type").addEventListener('change', function() {
if(document.querySelector("[id*='InsertRecordSurvey_Group_Type']").value == "PAT");
document.querySelector("[id*='InsertRecordPAT_Test']").value = 1;
document.querySelector("[id*='InsertRecordPAT_Test']").disabled = true;
}); // end of change event listener
}); // end of DataPageReady event listener
</script>
Thanks in anticipation
Link to comment
Share on other sites
2 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.