I have an app that ask 2 things 1. How do you feel? 2. what date is it?
The answer to question 1 is shown correctly in the list but the date is always the value of the last entry.
To display the date, I have in the template:
@Content.Datum.ToString("dd-MM-yyyy")
(Datum is not misspelled, just Dutch)
Thanks Daniel, for helping out.
There are 2 components to this issue.
The answer to the question is:
Use in the template >@entry.Datum.ToString("d")
to apply the date, coming from the datePicker. The entry is a variable set in @foreach(var entry in AsDynamic(Data["Default"]))
The other part is to prefill the date with the current date. This can be accomplished by adding a bit of code to the script to allow users to put data in the site.
<script>
function addProject(tag) {
$2sxc.cms.run(tag, "new", { contentType: "Diary", prefill: { Datum: new Date().toISOString() } })
}
</script>