Hi, i sent an email to your support address a week ago, but haven’t received a response. Maybe it went to spam or something? Anyway, i bought Date Picker for a unity android project, but i’m having an issue with the input box reverting to default after the text property is changed in code.
Here’s my situation. I have a prefab which includes a popup date picker, among other things. I instantiate one prefab for each row in a database table. After each prefab is instantiated, i change the date picker input field text to the existing date string from the database table row.
Here is how i’m filling the input field. ItemRow is the instantiated prefab.
ItemRow.transform.Find("ItemEditPanel/ItemEditDatePicker/Input Field Container/Row/Cell/ItemEditDatePickerInputField").GetComponent<InputField>().text = item.ItemDate;
When i run the program and generate the list of prefabs, the date from the database fills the input field, but after a split second, the input field then resets to the placeholder text that i set in the editor.
I read this in the user guide pdf:
“DatePicker will automatically update whenever any changes are made to any of its properties.”
So does that mean i am causing it to update to it’s default state by changing one of it’s properties (changing the input box text from code)?
I have other input fields in the same prefab that don’t have this resetting issue, so it seems like it’s specifically related to the update mentioned in the user guide. How can i make it so that the input field only changes when a date is selected, or when it is changed in code (ie. when it is deliberately changed)?
Sorry for the delay in responding - I don’t seem to have received your e-mail in my support address (I’ve just checked the spam folder as well and it wasn’t there - did you send it to support@digital-legacy.co.za?)
With regards to your question:
The text value in the input field is strictly controlled by DatePicker, as such any changes to it directly will be lost whenever DatePicker deems it necessary (which may be for any number of reasons, including initialization, date value changes, etc.). Rather than setting the text of the input field, you should rather be setting the date value of the DatePicker itself - DatePicker will then set the text for you, for example:
Awesome, i just tried it like that and it works perfectly. Thank you.
As for the email, i checked again and i did send to that exact address. On my end it seems to have been sent without issue. If you care to investigate further on your end, the email was sent on May 18, 2019, 1:32 PM CST(UTC -06:00). The subject line is “date picker issue”, and it was sent from a gmail address that starts with “blevok”.
Just double-checked my e-mail client and nothing is there - I’m not sure why your e-mail didn’t come through. Oh well, at least you were able to contact me here
i have a problem with the datepicker i have had to resize the input to fit my needs.
i also have multiple datepickers as i need these
the date on these shows current month but when changing to the following month it goes blank
Hi, i have another question about the date picker.
If i open the date picker, and move to a different month, and then close the date picker without selecting a date, and then open it again, the visible month doesn’t reset to the current month.
I tried resetting it like this, but it doesn’t work.