JSFiddle - React, Tailwind, and code Playground

by painotpi

HTML

<script>
    function formatValues(form, rowIndex) {
    var beginElem = "manualValueInputPO[";
    var endElement = "]";
    var dataTypeCode = document.getElementsByName(beginElem + rowIndex + endElement + ".dataTypeCode")[0];
    var attributeName = beginElem + rowIndex + endElement;
    if (dataTypeCode.value == '468') { //dollar
        formatDollarAmount(form, attributeName);
    } else if (dataTypeCode.value == '469') { //whole number
        formatNumber(form, attributeName);
    } else if (dataTypeCode.value == '466') { //percent
        formatPercentAmount(form, attributeName);
    } else if (dataTypeCode.value == '470') { //Text
        formatTextAmt(form, attributeName)
    } else if (dataTypeCode.value == '467') { //Date
        formatDateAmount(form, attributeName);
    }
    value = "";
}

function formatPercentAmount(form, attributeName) {
    var manualValueAmt = document.getElementsByName(attributeName + ".manualValueAmt")[0];
    var manualValPctNum = document.getElementsByName(attributeName + ".manualValPctNum")[0];
    var decimalForTabOut = document.getElementsByName(attributeName + ".decimalForTabOut")[0];
    if (manualValPctNum.value != undefined && manualValPctNum.valu`enter code here`e != '') {
        if (isNaN(manualValPctNum.value)) {
            alert("Enter numeric value only without entering any '$', comma, '( )', '%', or alphabets. Use '-' when entering a negative value.");
            value = "true";
            manualValPctNum.focus();
            manualValPctNumFlag = true;
            modifiedString = "";
            replacedChar = "";
        } else {
            var amt = manualValPctNum.value;
            amt = amt.toString();
            decimalForTabOut.value = amt.indexOf('.');
            var indexPos = amt.indexOf('.');
            if (indexPos == -1) {
                modifiedString = amt.concat("00");
                nonDecimalPoint = true;
            } else {
                var pctNumBeforeDecimal =...