title: I need to redirect iframe to different page when the form is submitted
body: <p>This is my code:
  I have tried many ways to redirect iframe to a different page when the function is called.
  I need to solve this and I need to know how to load iframe on a different page when I input the alphabet in the input field</p>
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>function setAction(form) {
    var inp = document.getElementById("oid").value;
    var letters = /^flow/i;
    var numbers = /^[0-9]/i;
    var empty = /^(?!\s*$).+/;
    if (oid.value.match(letters)) {
      // var page = "https://flowpl.com/track/"
  
      form.action = "https://flowpl.com/test-page/";
      // window.top.location.href = page;
  
      // location.href = "https://flowpl.com/test-page/";
    } else if (oid.value.match(numbers)) {
      let url_string = "https://tracker.flowpl.com/track_customer_orders";
      let refNum = document.getElementById('oid').value;
      window.location.href = url_string + "?refNum=" + refNum + "&amp;lang=english";
    }
    // else  {
    //    // alert('Please input numeric characters only');
    //    // document.test.oid.focus();
    //    return false;
    // }
    return false;
  }
  
  function loadintoIframe(info) {
    if (typeof info.id !== 'undefined' &amp;&amp; typeof info.src !== 'undefined') {
      document.getElementById(info.id).src = info.src;
  
    }
  }
  window.onload = function() {
    document.forms['test'].elements['submit'].onclick = function() {
      // let page = "https://flowpl.com/track/";
      let myIframe = document.getElementById("myiFrame");
      let url_string = "https://flowpl.portal.shipsy.in/track/result";
      let refNum = document.getElementById('oid').value;
      let adsURL = url_string + "?refNum=" + refNum + "&amp;searchBy=referenceNumber";
      console.log(adsURL);
      // let frame = window.location.href = "https://flowpl.com/track/";
      // let frame = window.frames["myiFrame"].top.location = "https://flowpl.com/track/"
      // window.top.location.href = page;
      myIframe.src = adsURL;
  
  
    }
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;div class="container-wrap"&gt;
    &lt;div class="container main-content"&gt;
  
      &lt;div class="row"&gt;
        &lt;form name="test" method="POST" onsubmit="return setAction(this)"&gt;
          &lt;input type="text" name="oid" id="oid" value="" required&gt;
          &lt;input type="submit" name="submit" value="submit"&gt;
        &lt;/form&gt;
  
        &lt;iframe style="border:0px #ffffff none;" name="myiFrame" id="myiFrame" scrolling="yes" frameborder="1" marginheight="0px" marginwidth="0px" height="500px" width="1200px" allowfullscreen&gt;&lt;/iframe&gt;
      &lt;/div&gt;
      &lt;!--/row--&gt;
  
    &lt;/div&gt;
    &lt;!--/container--&gt;
  
  &lt;/div&gt;</code></pre>
  </div>
  </div>
  </p>