Date field to not allow any characters or numbers in the record producers
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-03-2024 03:22 AM - edited 05-03-2024 03:31 AM
Hello Everyone,
I have a date field where I don't want to allow the date field to enter any characters or numbers in the record producer. Can anyone help me in achieving this.
1 REPLY 1
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-04-2024 11:47 PM
Hello @ChanduM ,
You can write the onChange Client script like below and select the field as date field.
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
if (oldValue == newValue) {
return;
}
g_form.hideFieldMsg('variable_name');
if (!validate(newValue)) {
g_form.showFieldMsg('variable_name','Not a valid date.','error');
g_form.setValue('variable_name', '');
}
}
function validate(value) {
if(!value)
return true;
if(typeof g_user_date_format !== 'undefined')
return isDate(value, g_user_date_format);
return parseDate(value) !== null;
}
Please mark my answer as helpful or correct if it helps to resolve your issue.
Regards,
Namrata