Elderberg Posted January 4, 2020 Report Share Posted January 4, 2020 Hi, this might be a bit advanced.. If i'm using a SubmissionForm Datapage i would be able to use the following to retrieve the value of a field: var Flag = document.getElementById('UpdateRecordYesNo').value; but i'm using a Tabular Report Datapage paired with a HTML Block . I'm trying to get the value of [@field:YesNo] and assign it to a variable called Flag. Can someone help me with the correct syntax to reference a field associated with the current row of a tabular datapage? <div id="mydiv[@field:CMP_ID2]"> </div> <SCRIPT LANGUAGE="JavaScript"> var Flag = [@field:YesNo^] if ( Flag = 1){ document.getElementById("mydiv[@field:CMP_ID2]").innerHTML = "X" ; } else{ document.getElementById("mydiv[@field:CMP_ID2]").innerHTML = "Y" ; } </SCRIPT> Quote Link to comment Share on other sites More sharing options...
CoopperBackpack Posted January 8, 2020 Report Share Posted January 8, 2020 Hello @Elderberg, Please, try to add the addEventListener() method to your code. Also, change the comparison in the IF condition to this one: Flag == 'Yes'. The code example: <div id="mydiv[@field:CMP_ID2]"> </div> <script type="text/javascript"> document.addEventListener('DataPageReady', function (event) { var Flag = "[@field:YesNo^]"; if (Flag == 'Yes'){ document.getElementById("mydiv[@field:CMP_ID2]").innerHTML = "X" ; } else{ document.getElementById("mydiv[@field:CMP_ID2]").innerHTML = "Y" ; } }) </script> I hope this information will be helpful. Quote Link to comment Share on other sites More sharing options...
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.