Current date is set for date question when I want the field to be blank

What is the problem? Please be detailed.
when I collect data on ODK on my android device it is taking a default date (current date) when I need the date field to be blank, even when I remove response for that filed i tagain comes with current date

What ODK tool and version are you using? And on what device and operating system version?
ODK collect V1.16.4
What steps can we take to reproduce the problem?

What you have you tried to fix the problem?
I trie looking for help on website added default field but not solved
Anything else we should know or have? If you have a test form or screenshots or logs, attach here.

Hi @drnareshchauhan,

You can add one more question before asking date in your form which looks like " Do you want to enter date?" If respondent said yes then date type question will be asked otherwise that question will skip and you will not get any response in that question.

Best,
@iamnarendrasingh

1 Like

Thanks Narendra I have lot of field of this type, I tried that but when person skips that field its taking the default date, which is I am struggling with So I have to put more than 10 questions before each date field, that I dint want, but any way If there is no alternate solution I have to go with it!
thanks!

If the usecase is to return a date for the form - either the user-specified date if they enter it, otherwise the current date - you should be able to accomplish this with:

Q1: id=userdate, type="date"
Q2: id=returndate, type="date", calculate="coalesce(${userdate},today())"

Where Q2 returndate is the actual result that you are really interested in. Basically, if userdate is set then it'll return it, otherwise it'll return today's date. [note: this calculation will be constantly re-evaluated as you fill in the form, so today's date will be whatever it is when you finally submit the form].

You might also want to look at this previous thread.

1 Like

If you are trying to set a default date, @Xiphware is correct that you have to make sure to use a strategy for dynamic defaults. There is more information and an alternate approach described in the documentation.

If you are simply trying to collect a date, this sounds like a bug either in Collect or in your form design. The intended behavior is that the date is blank until the person filling out the form taps the "Select date" button and selects a date. The text below the button should say "No date selected" until a date is selected. Is that what you see? You can see screenshots of the intended behavior in the documentation.

I have tried all of the different date question variations using the All Widgets form on the default server and confirmed that if I leave the questions blank, I get blanks in the form submission. If I set a value, save it and reopen the form, that value is available. If I clear the value, save the form and reopen the form, the value is blank.

If @Xiphware's suggestion or the documentation about dynamic defaults don't help you, can you please describe exactly what you are doing and indicate the device you are using?

Thanks Mam I tried all widgets but still it is taking the date where I want it blank, what is the solution for the bugs, I want it to be no date selected field.
thanks

Can you please be very specific about what you are trying to do and what your setup is? It could be a bug but unless someone can reproduce it, it can't be confirmed or addressed.

  • Are you just trying to include a date with no appearance and no default? Can you share your form?
  • What is your Android version?
  • What device are you using?
  • Is what you're seeing exactly what is described in the documentation?
  • How exactly are you filling out the form? Are you tapping the "Select date" button?
  • Where are you seeing that a date that you want blank is set?
1 Like

It will be great if you will share your form here so we can see problem and resolve that more quickly.

Best,
@iamnarendrasingh

thanks everyone this issue solved as it was due to the another application of health and family welfare using same ODK application but customized for collecting immunization monitoring details on ODK aggregate. so when I uninstalled that application, It started appearing as no date selected as shown in widget !
thank you all again!

2 Likes