How can I set a Date/Time format of a textbox to behave like a phone number format, where the user only enters numbers, but it displays some other way of my choosing.
// get new Date object
var a = event.target.value;
var oDate = util.scand("yyyymmdd", a);
// format to yyyy/mm/dd
var xDate = util.printd("yyyy/mm/dd", oDate);
event.target.value = xDate;
This doesn't work.
Text type fields have scripts that control keystroke, validation, and formatting. You are only playing with the formatting.
You could create a keystroke script to allow the entry of the date with or without the "/" but you would then need to write a format and validation script. Date validation is not just months 1-12, and days 1 - 31 because certain months have 28, 29, 30, or 31 days depending upon the month and year combinations.
And don't use event.target.value, but event.value ...