JSFiddle - React, Tailwind, and code Playground

by Raul Bojalil

HTML

<input type="button" onClick="submitForm(1)" class="red-input" value="Patient 1">
<input type="button" onClick="submitForm(2)" class="red-input" value="Patient 2">

JavaScript

function submitForm(clientId) {

	var name = 'test' + clientId;
  const form = document.createElement("form");
  form.setAttribute("method", "post");
  form.setAttribute("action", "https://sts.demo-careconnect.ca?clientId=" + clientId);
  form.setAttribute("target", name);

  form.onsubmit = function() {
    window.open('about:blank', name, '');
  };
  
  document.body.appendChild(form);
  form.submit();
}