Copy link to clipboard
Copied
Hello all, I have been tasked with this request
1. Have place holder text or Default value display "MM/DD/YYYY" to the user
2. If data is entered, have custom validation the forces a date format of MM/DD/YYYY
I know it would be so much easier to just make it a Date data type, but the customer does not like the calendar tool. I have experimented with some of the js and js with RegExpressions solutions (posted in this forum and others) and came close but no success.
Is this even possible? is there some js that can add placeholder text
Thanks for any help, Richard
For the first part, use this custom format script:
if(/^\s*$/.test(event.value))
event.value = "MM/DD/YYYY";
This script tests the current input. If it is empty, the field displays the default text.
Copy link to clipboard
Copied
For the first part, use this custom format script:
if(/^\s*$/.test(event.value))
event.value = "MM/DD/YYYY";
This script tests the current input. If it is empty, the field displays the default text.
Copy link to clipboard
Copied
Perfect Thom, thanks. I added the validation and it's working exactly as I wanted
Copy link to clipboard
Copied
This is the validation I used
if (event.value) {
var d = util.scand("mm/dd/yyyy", event.value);
if (/^\d{2}\/\d{2}\/\d{4}$/.test(event.value)==false || d==null) {
app.alert("Invalid date string entered. You must enter a date in the following pattern: MM/DD/YYYY");
event.rc = false;
}
}