Show toggle when some field not empty

How can I use ‘when’ to show a toggle field when for example a date field or a users field is not empty? The example underneath doesn’t work.

fields:
  date:
    label: Date
    type: date
    time: true
  showdate:
    label: Show date
    type: toggle
    when:
       date: true
    icon: calendar

In the code reference it says about e.g. the users field: ‘Conditions when the field will be shown (since 3.1.0)’. But doesn’t give any examples, would be nice if it did?

Cheers

I would think its because a date feild is never true or false, it either has a value or it doesnt. The when will toggle it when that value matches (ie, the date field has a specific date and time in it).

Currently, it is not possible to use advanced queries in conditional fields. So with a date field, using when doesn’t really make sense.

https://getkirby.com/docs/guide/blueprints/fields#conditional-fields

Ok, clear. So when only accepts true or false?

The date field is the one field thats a bit tricky. It doesnt have be a true/false type thing. You can do it on a select field for example, on the value of the select. With a date field, there are billions of possible entries, so its hard to know what the value might be in order to set the “when”. I think eventually (but probably not soon) the conditional fields will be able to detect a date between a set range or something.

There are quite a few feature requests in the ideas repo. You might want to upvote them:

Ok, thanks to you both. (Still it would be very helpful to be a bit more explicit in the reference, if you find the time :wink: )