Hi, I'd like to put a alert message box on the screen to give the user an instruction.
I'm creating a submission datapage which contains a cascading Textbox named Barcode (which is not visible to the user) and a Text(255) box named Count (which is visible). The Barcode box will only ever be "Yes" or "No" and these are contained in a table. When the user clicks on the Count box:-
If the Barcode value is "Yes" then I want a message box or "Alert" to show "Value in the Count box MUST be 1".
If the Barcode value is "No" then the message should read "Value in the Count box can be any positive numeric value".
Here's the code but it's not doing it for me.
<script text="JavaScript">
document.addEventListener("DataPageReady", function (event) {
if (document.querySelector("[input[id*='InsertRecordBarcode']").value ==='Yes' );
{window.alert("Value in the Count field MUST be 1");
return false;};
else {
if (document.querySelector("[input[id*='InsertRecordBarcode']").value ==='No');
{window.alert("Value in the Count field can be any positive numeric value");
return false;};
};
};
</script>
I'm a beginner at Javascript and would be delighted if someone can help with this. Thanks in anticipation.
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'd like to put a alert message box on the screen to give the user an instruction.
I'm creating a submission datapage which contains a cascading Textbox named Barcode (which is not visible to the user) and a Text(255) box named Count (which is visible). The Barcode box will only ever be "Yes" or "No" and these are contained in a table. When the user clicks on the Count box:-
Here's the code but it's not doing it for me.
<script text="JavaScript">
document.addEventListener("DataPageReady", function (event) {
document.querySelector("[id*='InsertRecordCount']").addEventListener('click', function() {
if (document.querySelector("[input[id*='InsertRecordBarcode']").value ==='Yes' );
{window.alert("Value in the Count field MUST be 1");
return false;};
else {
if (document.querySelector("[input[id*='InsertRecordBarcode']").value ==='No');
{window.alert("Value in the Count field can be any positive numeric value");
return false;};
};
};
</script>
I'm a beginner at Javascript and would be delighted if someone can help with this. Thanks in anticipation.
Link to comment
Share on other sites
1 answer 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.