JSFiddle - React, Tailwind, and code Playground

by Dimitar Christoff

HTML

<form id="formulario" method="post" name="formulario" action="result.php" onSubmit="return fecha()">
    <input id="C7" type="text" id="dateArrival" size="10" value="">
    <input id="send" name="send" type="submit" value="Submit" />

JavaScript

function fecha() {
    fecha = document.getElementById('C7');
    if (fecha.value == "") {
        alert('You must indicate the approximate date of arrival');
        return false;
    }
}


window.onload = function() {
    fecha();
    try {
        fecha();
    }
    catch(e) {
       alert(e.message);
    }
};