Forum

Thread tagged as: Problem, Error, Field-Types

Slug with date

Here is the html template for my test region

<perch:content id="event_date" type="date" label="Date of event" format="d-m-y" />
<perch:content id="slug" type="slug" for="event_date" editable="true" />

I assume this would auto fill the slug with "15-03-17" but instead it stays empty. If I then save the region and go back into it, the slug is filled with "ra-d41d-cd98". Initially I was trying to get it to work with for="heading event_date" but this would only auto fill the heading and still leave out the event date. I don't get it, is there something i'm missing?

Andrew Wallace

Andrew Wallace 0 points

  • 4 years ago
Duncan Revell

Duncan Revell 78 points
Registered Developer

I can't remember why using using a date field in the slug doesn't work - but it doesn't. As you have discovered.

Break the date down into day month year - as follows for your example:

<perch:content id="slug" type="slug" for="event_date_day event_date_month event_date_year" editable="true" />

Oh sweet that works perfectly cheers.