Making constraint with date entry (allowing only today's date)

Hi team, I’m facing the same problem. I’m trying to make a validation for a data.
Date of data entry . this condition does work for me , what can I do? Validation criterian ${date of data entry} = today()

Hi @williamouchi,

Welcome to the community! You could do the same as outlined in the image below:

In the survey tab of your xlsform:

Reference xlsform:
Date Inputs (Past, Current, Future).xlsx (16.9 KB)

Please note: This best works with Collect apps (KoBoCollect android app or ODK Collect android app). It may not work as it should in Enketo (at the moment).

Have a great day!

1 Like

Hi Dear @Kal_Lam , i’m trying to put the formular but in vain. I want just tomake sure surveyor consider the exact date of data collection but not the different date. I validation criteria, this formular does not work. I’m using online form builder but not the xls form. In the validation createrian, I’m writing this code ${date of data entry} . = today()

Hi @williamouchi,

You could design the same (in KoBoToolbox Form Builder User Interface) as shown in the image below:

Have a great day!

can you have a look on my formular?

OK got it, looking at your variable name i see an error in it i.e. ${date of data entry} it should be ${date_of_data_entry} = today(). Space not allowed. Or you could simply use . = today() where . refers to ${date_of_data_entry}.

This should solve your issue!

Have a great day!

please can you create one date question and send me your xlm form? thanks have a good day. william from drc congo(beni town)

Hi @williamouchi,

Please check out post 2. I have shared an xlsform there:

Have a great day!

1 Like

Hi all i am making a form for ODK collect and this constraint . = today()
is not working to limit entries to only today’s date.

Welcome to the community @bmakori! Would you mind sharing your xlsform with the community. The community should be able to help you out.

Hello,
If you want to limit to a FIXED date, you can use = date(“2021-01-12”).
If you want to limit to the first date this form was started, you ccould yus = ${today}. And use metadata type today, name today.

The today() function is updating when you save/edit the form.
If you explain here more your demand, we can better support you.

1 Like

Thank you @wroos this helped

1 Like

Fantastic, it’s working. I couldn’t find this previous post.
Thanks a lot for your prompt answer…