JSFiddle - React, Tailwind, and code Playground

by Brian Houlihan

HTML

<body onload='popAllContactFields()'>
<form action="#" name="data" id="data">
<table>
  <tr><td colspan="2" align=center>Contact Info:</td></tr>
  <tr>
    <td>First Name:</td>
    <td><input type='text' readonly="readonly" name='cfname' /></td>
    <td><input type='button' value='Populate Contact Info' onclick='popContact()' /></td>
  </tr>
  <tr>
    <td>Last Name:</td>
    <td><input type='text' readonly="readonly" name='clname' /></td>
  </tr>
  <tr>
    <td>Email:</td>
    <td><input type='text' readonly="readonly" name='cemail' /></td>
  </tr>
  <tr>
    <td>ID:</td>
    <td><input type='text' readonly="readonly" name='cid' /></td>
  </tr>
  <tr><td height=40 colspan="2" valign=bottom align=center>Billing Address:</td></tr>
  <tr>
    <td>Street:</td>
    <td><input type='text' name='street' /></td>
    <td><input type='button' value='Populate Address' onclick='popAddr()' /></td>
  </tr>
  <tr>
    <td>City:</td>
    <td><input type='text' name='city' /></td>
    <td><input type='button' value='Update Address' onclick='upAddr()' /></td>
  </tr>
  <tr>
    <td>Province/State:</td>
    <td><input type='text' name='province' /></td>
  </tr>
  <tr>
    <td>Postal Code:</td>
    <td><input type='text' name='zip' /></td>
  </tr>
  <tr>
    <td>Country:</td>
    <td><input type='text' name='country' /></td>
  </tr>
  <tr><td height=40 colspan="2" valign=bottom align=center>Custom Fields/System Attributes:</td></tr>
  <tr>
    <td>String CF:</td>
    <td><input type='text' name='cfstr' /></td>
    <td><input type='button' value='Get' onclick='popStrCF()' />&nbsp;
        <input type='button' value='Set' onclick='upStrCF()' /></td>
  </tr>
  <tr>
    <td>Int CF:</td>
    <td><input type='text' name='cfint' /></td>
    <td><input type='button' value='Get' onclick='popIntCF()' />&nbsp;
        <input type='button' value='Set' onclick='upIntCF()' /></td>
  </tr>
  <tr>
    <td height=40 colspan="2" valign=bottom><input type='checkbox' name='alerts' checked='true'...

JavaScript

/* onbeforesave(Boolean continue, String Msg)
Executed when a save has been requested, but before the save is executed.
Param 1: Boolean - If true, continue saving. If false, cancel the save.
Param 2: String  - The message that is dispalyed to the user.
*/
function onbeforesave()
{
    // prompt the user and capture their response
    var success = true;
    if (data.alerts.checked)
        success = confirm("save ok?");
    // execute the response
    window.external.beforesavecomplete(success, "beforesavecomplete message");
}

/* onsave(Boolean continue, String Msg)
Executed after a save is executed. This is mainly used to display a message
to the user after a save operation.
Param 1: Boolean - Ignored.
Param 2: String  - The message that is dispalyed to the user.
*/
function onsave()
{
    // display the same complete message
    window.external.savecomplete(true, "save complete message");
}

/* onclose(Boolean continue, String Msg)
Executed when a close is requested. This is mainly used to display a message
to the user after a close operation.
Param 1: Boolean - Ignored.
Param 2: String  - The message that is dispalyed to the user.
*/
function onclose()
{
    // display the same complete message
    window.external.closecomplete(true, "close complete message");
}

/* oncancel(Boolean continue, String Msg)
Executed when a close has been requested, but before the closed is executed.
Param 1: Boolean - If true, continue closing. If false, cancel the close.
Param 2: String  - The message that is dispalyed to the user.
*/
function oncancel()
{
    // prompt the user and capture their response
    var success = true;
    if (data.alerts.checked)
        success = confirm("close without saving?");
    // execute the response
    window.external.cancelcomplete(success, "cancelcomplete message");
}

var currentCId = window.external.Incident.CId;
/* ondataupdated(String ObjName)
Executed when data is updated in the current workspace.
Param 1: String - The name of the...