Jump to content
  • 0

Screen Message To User



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) {

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;};

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

  • 0

Hello @RonAnderson,

May you please try this one:

<script type="text/javascript">
var barcode = document.getElementsByName('InsertRecordBarcode')[0];
barcode.addEventListener('change', function() {

if(barcode.value == "Yes"){
alert("Count MUST be 1");
alert("Value in the Count field can be any positive numeric value");

Hope this helps!

Link to comment
Share on other sites

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.

Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...