Expand my Community achievements bar.

Guidelines for the Responsible Use of Generative AI in the Experience Cloud Community.

Calander question

Avatar

Level 7

Is it possible for a Date/Time Field user not to be able to type the date(Not allow custom entry)?

Users they have to choose(mandatory) from the calander!

We like to avoid mistake about date format!

Any solution or idea?

Thanks

1 Reply

Avatar

Level 10

I had the same issue in the past and looking forward for a right answer..

To resolve this issue in our earlier forms we did the following..

     We have written a custom Javascript function to validate the date format entered. We have executed the java script function in the Validate event of the field and if the format is not correct, then we will erase the data and force the user to stay in the field until they enter the correct format.

    To make the user aware of the format, we had added a text with the expected format either in the caption or below the input area of the date field.

    In the change event of the field we restricted the input to 10 characters and allowed only to enter numbers and slash (/) only.

     //Restrict the input to 10 digits

     if(xfa.event.newText.length >10)xfa.event.change = "";

    

     //Allow only numbers and slash

     if (xfa.event.change.match(/[0-9\/]/) == null)
          xfa.event.change = "";

Thanks

Srini