JSFiddle - React, Tailwind, and code Playground

by Nic Fontaine

HTML

<form enctype='application/json' id='ets-application-form-01' action='check-in.html' method='get'>

  <fieldset>

    <label for='transaction-type'>Transaction Type</label>
    <select name='AppointmentTransaction[-TransactionType]' id='transaction-type'>
      <option value='New' selected>New</option>
      <option value='Update'>Update</option>
      <option value='Reschedule'>Reschedule</option>
      <option value='Cancel'>Cancel</option>
    </select>

    <label for='RegistrationSystemCode'>Registration System Code</label>
    <input name='AppointmentTransaction[-RegistrationSystemCode]' id='RegistrationSystemCode' value='EREG'>

    <label for='RegistrationMethod'>Registration Method</label>
    <input name='AppointmentTransaction[-RegistrationMethod]' id='RegistrationMethod' value='Web'>

    <label for='TransactionDate'>Transaction Date</label>
    <input name='AppointmentTransaction[-TransactionDate]' id='TransactionDate' value='2016-06-16' type='date'>

  </fieldset>

  <fieldset id="fieldset-candidate">
    <h4>Candidate</h4>

    <label for='Candidate-CandidateID'>ID</label>
    <input name='AppointmentTransaction[Candidate][-CandidateID]' id='Candidate-CandidateID'  value='10936803'>

    <label for='Candidate-CandidateID'>Last Name</label>
    <input name='AppointmentTransaction[Candidate][CandidateName][LastName]' id='Candidate-CandidateID'  value='Adams'>

    <label for='Candidate-FirstName'>First Name</label>
    <input name='AppointmentTransaction[Candidate][CandidateName][FirstName]' id='Candidate-FirstName'  value='Natalie'>

    <label for='Candidate-MiddleName'>Middle Name</label>
    <input name='AppointmentTransaction[Candidate][CandidateName][MiddleName]' id='Candidate-MiddleName'  value='A'>
  </fieldset>

  <fieldset>
    <h4>Appointment</h4>

    <label for='Appointment-AppointmentID'>ID</label>
    <input name='AppointmentTransaction[Appointment][-AppointmentID]' id='Appointment-AppointmentID'  value='100315'>

    <label...

CSS

html {
  background: #eee;
}

html, body {
  margin: 0;
  font-family: sans-serif;
  color: #666;
  font-size: 12px;
}

::selection {
  background: #DEABD7; /* WebKit/Blink Browsers */
  color: #fff;
}
::-moz-selection {
  background: #DEABD7; /* Gecko Browsers */
  color: #fff;
}

form {
  padding: 20px;
  max-width: 400px;
  width: 30%;
  box-sizing: border-box;
}

fieldset {
  background: #fff;
  border: none;
  box-shadow: 0 2px 6px rgba(0,0,0,0.2);
  padding: 25px 29px 5px 25px;
  box-sizing: border-box;
  margin-bottom: 20px;
  position: relative;
  overflow: hidden;
  transition: all 0.4s;
  z-index: 1;
}

h4 {
  display: inline-block;
  font-weight: bold;
  padding: 0;
  padding-bottom: 5px;
  text-align: center;
  font-size: 1.8em;
  margin-bottom: 20px;
  /*border-bottom: 1px solid #ddd;*/
  font-size: 1.5em;
  color: #0098a0;
  margin-top: 0;
}

fieldset:before {
  width: 500px;
  height: 200px;
  background: #f9f9f9;
  content: '';
  position: absolute;
  transform: rotate(40deg);
  z-index: -1;
  top: -30px;
  right: -300px;
}

label {
  display: block;
  margin-bottom: 4px;
  color: #838383;
  font-size: 0.79em;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  font-weight: bold;
  word-spacing: 3px;
  font-family: 'Raleway', sans-serif;
}

input, select, textarea {
  margin-bottom: 25px;
  color: #c5c5c5;
  background: none;
  border: none;
  padding: 6px;
  font-family: 'Roboto', sans-serif;
  font-weight: 300;
  font-size: 1.4em;
  width: 100%;
  box-sizing: border-box;
  border-bottom: 1px solid #eee;
  transition: border-color 0.9s;
}

input:focus, select:focus, textarea:focus {
  border: none;
  padding: 6px 6px 4px;
  outline: none;
  /*background: #f9f9f9;*/
  border-bottom: 3px solid #0098a0;
}

input[type='submit'] {
  background: #00a2ab;
  color: #fff;
  padding: 15px 22px 19px 22px;
  border-radius: 5px;
  margin-top: 10px;
  text-transform: uppercase;
  font-family: 'Josefin Sans', sans-serif;
  font-weight: 700;
 ...

JavaScript

var appForm = $('#ets-application-form-01');

appForm.on('submit', function(e) {
	e.preventDefault();
	var formData = JSON.stringify(appForm.serializeArray());
  document.getElementById('json-data').innerHTML = formData;
	// ALLOW SUBMIT AT THE END
  //this.submit();
});


// SET 'SELECT ALL' ON ALL INPUTS ON SELECT
var inputsDom = document.getElementsByTagName('input');
var inputsDomLength = inputsDom.length;

for (i=0; i<inputsDom.length; i++) {
	inputsDom[i].setAttribute('onclick','this.select()');
}