Refresh event_ID after submission

  • Profile Image
    NYSMAudioVisual
    Asked on September 29, 2017 at 12:09 PM

    I've added all the source code to my site.  I'm not embedding because I like to have a little more control over the styles.  

    When a user fills out the form and returns to the form their information is still filled in.  This is because the event_ID has not been refreshed from when they submitted the info.  

    Is there a way, using source code to tell the form to refresh the event_ID maybe using a string in the URL.  Additionally can someone return to edit their form by adding the event_ID string in the URL.  

    I see how jotform does this in their email notification. How can I do it with my own site?  

  • Profile Image
    Chriistian
    Answered on September 29, 2017 at 12:43 PM

    I was able to replicate the problem. However, I am not currently sure how the value in event_id is being generated since it is mixed with your own code. Can you please give us more information as to how your form currently works?

    Are you doing some custom coding to generate the event_id value?

    How do you prepopulate the fields? Did you apply custom coding to do that functionality as well?


  • Profile Image
    NYSMAudioVisual
    Answered on September 29, 2017 at 01:28 PM

    I'm really just hosting the JS/css on my site and adding the html to the page.  I'm not doing anything to prepopulate the fields.  It seems like the browser is able to read the submitted data with old event_ID in the code.  When I go back to the form after submitting, the event_ID hasn't changed. I believe it might have to do with something here:

    <code>

        function createImageEl(uuid) {

          var base = '//events.jotform.com/';

          if (self.jsForm) { base = base + 'jsform/'; } else { base = base + 'form/'; }

          var src = base + _formID + '/';

          var resolutionStr;

          if (_screenHeight && _screenWidth) { resolutionStr = _screenWidth + 'x' + _screenHeight; }

          src = src + '?ref=' + encodeURIComponent(_referer);

          if (resolutionStr) { src = src + '&res=' + encodeURIComponent(resolutionStr); }

          if (uuid) { src = src + '&eventID=' + encodeURIComponent(uuid); }

          src = src + '&loc=' + encodeURIComponent(_location);

          var img = new Image();

          img.id = "event_tracking_image";

          img.src = src;

          img.alt = "jftr";

          img.style.display = 'none';

          return img;

        }


        function createEventID(uuid) { var inputEl = document.createElement('input');

          inputEl.setAttribute('type', 'hidden');

          inputEl.setAttribute('name', 'event_id');

          inputEl.value = uuid;

          _form.appendChild(inputEl); }


        function generateUUID() { return 1 * new Date() + '_' + _formID + '_' + randomString(7); }


        function randomString(len) {

          charSet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';

          var randomString = '';

          for (var i = 0; i < len; i++) { var randomPoz = Math.floor(Math.random() * charSet.length);

            randomString += charSet.substring(randomPoz, randomPoz + 1); }

          return randomString;

        }

      },


    </code>


    Does the var base need to be different if the JS is on my site?

  • Profile Image
    Kevin_G
    Answered on September 29, 2017 at 01:49 PM

    I have been reviewing your form and I can see the data is still there after submitting the form, besides the code you have added on your webpage, it seems like you have enabled the Auto-Fill feature on your form, may you please try disabling such option? 

    How-to-Enable-Auto-Fill-on-Forms

    Please let us know how it goes.

  • Profile Image
    NYSMAudioVisual
    Answered on September 29, 2017 at 02:09 PM

    this has no effect.  When we use the form via jotform it clears the information after submission, on our site it does not.  I believe it is because the event_ID is not being refreshed properly.  

  • Profile Image
    aubreybourke
    Answered on September 29, 2017 at 04:12 PM

    I tested your form and could reproduce the problem. I also noticed that your thank you url seems to be incorrect:

    You can see in the address bar the double slashes.


    Just to follow up on what my colleague suggested about autofill being enabled. The problem is that if you disable autofill you would need to download the source code again. So can you confirm you have done this please? It is highly likely this is the problem you are facing.

    Also, I have escalated this issue to the development team.


  • Profile Image
    NYSMAudioVisual
    Answered on October 03, 2017 at 02:27 PM

    That seemed to work.  I needed to update just the script included in the head of the HTML doc.  Thank you.