<input type="text">
<input type="hidden" name="h">
<input type="hidden" name="m">
<script>
document.querySelector("input[type=text]").addEventListener("input", function(event) {
var value = event.target.value;
var match = value.match(/^(\d{1,2})\D?(\d{2}|)$/) || [];
if(!match[1]) match[1] = "00";
if(!match[2]) match[2] = "00";
document.querySelector("input[name=h]").value = match[1];
document.querySelector("input[name=m]").value = match[2];
});
</script>