Skip to main content
Question

Passing Date Field and Rid to my codepage

  • August 8, 2019
  • 0 replies
  • 47 views

I am using the below code in a html code page but I need to pass my Date Field and my rid to this codepage. I am displaying the codepage in my form so that there is a countdown till due.


<p id="demo"></p>

<script>

var countDownDate = new Date("8-10-2019").getTime();


var x = setInterval(function() {


  var now = new Date().getTime();


  var distance = countDownDate - now;


  var days = Math.floor(distance / (1000 * 60 * 60 * 24));
  var hours = Math.floor((distance % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
  var minutes = Math.floor((distance % (1000 * 60 * 60)) / (1000 * 60));
  var seconds = Math.floor((distance % (1000 * 60)) / 1000);


  document.getElementById("demo").innerHTML = days + "d " + hours + "h "
  + minutes + "m " + seconds + "s ";


  if (distance < 0) {
    clearInterval(x);
    document.getElementById("demo").innerHTML = "EXPIRED";
  }
}, 1000);
</script>

The var countDownDate is where I need to get my fid 166 from what ever record I happen to open...

The code I am using to display the page is -

"<img data-url='" & [URL 1] & "'" &
" src onerror='(async () => {  var url = this.dataset.url;  this.outerHTML = '<iframe src=${url} width=155px height=50px></iframe>';})();'>"

Can anyone help?
This topic has been closed for replies.

So despite Dan Diebolt's recent inactivity, I can just feel him counting my sins from wherever he may be, but I'm going to try my best and give the solution I would do in a pinch.

Basically, I would divide the HTML into variables around the dates/IDs you want to use, e.g.
Name: [URL 1-1]
Value: <p id="demo"></p>
<script>
var countDownDate = new Date("
and so on, then in the Formula using [URL 1-1] & ToText([Date]) & [URL 1-2] etc., etc. Hope it works for what you're doing, and good luck!

  • Registered
  • August 8, 2019
I always just put the info I need into the URL that goes to the code page. Then you can pluck it out of there using things like window.location and parsing the URL. Just add the information you need on to the end like ?rid=xxxx and then parse it on the page.

I'm not sure that is going to do it when using an iframe though. You might still be able to send that info along.